ram_os
asked on
passing a variable in the address bar
How can I pass the variable name to the next page through the address bar? The way ive been trying will not pass anything after the blank space between the firstname and lastname
name = "adro ron";
out.print("<form name='Form1231' method='post' action="+request.getContex tPath()+"/ allocate_a ctualtime. jsp?custom ername="+f irstnames[ cnt]+lastn ames[cnt]+ "&names="+ name+">");
Thanks
name = "adro ron";
out.print("<form name='Form1231' method='post' action="+request.getContex
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yeah, sure :-)
You basically, can't have any special characters, spaces, "?"s, or "&"s in your parameters, as the browser will think they are gaps in the url, or the start of a parameter list or the next parameter, etc
So...
You have to encode the parameters so that they get read correctly by the browser
The way to encode things is like this:
%XX
where XX is the ascii value of the special character
So " " becomes "%20"
and URLEncoder.encode does this for you :-)
Hope you understand :-)
Glad I could help :-)
Tim
You basically, can't have any special characters, spaces, "?"s, or "&"s in your parameters, as the browser will think they are gaps in the url, or the start of a parameter list or the next parameter, etc
So...
You have to encode the parameters so that they get read correctly by the browser
The way to encode things is like this:
%XX
where XX is the ascii value of the special character
So " " becomes "%20"
and URLEncoder.encode does this for you :-)
Hope you understand :-)
Glad I could help :-)
Tim
ASKER
Could you explain your code plz and why I needed to do it, if you dont mind,
Thanks again