I'd like to make a simple link from a jsp (A) to another (B) with adding a parameter that I want to transmit from A to B.
In jsp A: <% String value="object_1"; %> <a href="url_b.jsp?code=<%= value %>"><%= value %></a>
In jsp B: <% String code = (String)request.getParameter("code"); %>
This operation is correctly done. But if I change the variable "value" of my jsp A into "object%1" there is a problem. The value of variable "code" in the jsp B is null. The problem seems to come from the character '%'
How can I do to avoid this problem in case of specific character that I have to consider in my application?
The returned url seems to be correct (test.jsp%3Fcode%3Dtest) but it doesn't works even if there is no specific character. The following error message is thrown: "The requested resource (/test.jsp%3Fcode%3Dtest) is not available"
Could you tell me what am I doing wrong? Or how can I use JSTL in this example (I hadn't ever use it).
The URL "test.jsp?code=banana" has one parameter, and it is "code=banana". You only have to apply URL-encoding to the parameter values, namely "banana" in this case. Do not URL-encode anything else.
Joined: Apr 20, 2006
Ok! So by this way a part of my problem is solved. The specific characters that were not recognized like %=@ are checked now. But I still can't make it work whith the unicode UTF-8 (Japanese characters for example).
That is what should enable me to recognize the unicode in the jsp pages: