Pass multiple variables in a query string

pmac38CDS
pmac38CDS used Ask the Experts™
on
I want to pass multiple variables in a query string. However is there anyway to pass them to avoid the url being very long ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
use POST for sending the parameters. The URL will only be formed by the site name and page name

Author

Commented:
Using POST is not an option in my case.
Top Expert 2010

Commented:
You can pass multiple parameters as follows:
<a href="yourpage.htm?code=XYZ&moreinfo=test%20description">Test link</a><br />


you can refer to this article on passing parameters and using javascript to retreive the parameters
http://javascript.about.com/library/blqs.htm
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
I guess that you could write some JS to make the parameters string, zip it, encode it and send the result as a value for a single new param
you would have to decode it on the server side
but this is a workaround
If yous Jsp then use hidden filed set the passing values in the hidden filed take it in java using request.getParameter()
leakim971Multitechnician
Top Expert 2014

Commented:
<form onsubmit="concatenate();return false">
<input id="a" />
<input id="b" />
<input id="c" />
<input id="d" />
<input type="submit" value="submit" />
</form>

Open in new window


with :

function concatenate()  {
   var a = document.getElementById("a").value;
   var b = document.getElementById("b").value;
   var c =  document.getElementById("c").value;
   var d = document.getElementById("d").value;
   location.href = "/path/to/page?AllInOne=" + encodeURIComponent( a + ";" + b + ";" + c + ";" + d ); // semicolon is a reserved char, you can choose an other one
}

Open in new window

Author

Commented:
leakim971:How can I read the concatenated values in the aspx page ?
Multitechnician
Top Expert 2014
Commented:
leakim971Multitechnician
Top Expert 2014

Commented:
Thanks for the points!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial