tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steffen Heil" <li...@steffen-heil.de>
Subject AW: Multiple arguments in a GET URL
Date Sat, 02 Oct 2004 05:57:05 GMT
Hi

> I am attempting to redirect to a URL that is similar to the following
>
http://www.mysite.com/index.jsp?mainFrame=somePage.jsp?item1=info1&item2=inf
o2
> However, I can only do a request.getParameter on item1 in the somePage.jsp
JSP.  When I attempt to do it for item2, it fails..

This is correct behavior.
Tomcat splits the url (at ?) as follows:

Called page: http://www.mysite.com/index.jsp
Parameters: mainFrame=somePage.jsp?item1=info1&item2=info2

Then the parameters are split (at &):

Parameter1: mainFrame=somePage.jsp?item1=info1
Parameter2: item2=info2

So mainFrame is a paramter to index.jsp, but item2 is ALSO.

You want only one Parameter. So you need to urlEncode that one:
Called page: http://www.mysite.com/index.jsp
Parameters: mainFrame=somePage.jsp?item1=info1&26item2=info2

You just jeed to replace & with &26. Propably it would be best to replace
the ? as well, but I just don't have it's ascii code in mind.

You complete URL would be:
http://www.mysite.com/index.jsp?mainFrame=somePage.jsp?item1=info1%26item2=i
nfo2
No code change needed.

Regards,
  Steffen

Mime
View raw message