Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using % sign within a scriptlet  RSS feed

 
Sarah Gaikwad
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a jsp page which receives a request. This request contains a string.
for example:
<%
String a = request.getParameter("query");
%>
Now the value of a will be as follows:
Wildcard character % is not allowed.

However, the jsp page fails to parse because of the % sign which is displayed within the scriptlet.

Is there a work around.
Please help
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you sending this parameter through the URL?
% is a special escape character in a URL as well.
Just typing it into the address bar won't work.

http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

Take a look at the class java.net.URLEncoder.


The code you have here wouldn't cause the jsp to fail compilation.
It might create a problem with displaying the HTML but I don't think it would have an issue.
What is the actual error/problem you have?
What do you do with the variable "a" ?
 
Sarah Gaikwad
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The link helped. Thanks a ton.

I have a javascript method that passes the message to a popup jsp page. All the while I was getting an error when i tried to send % through the javascript method.

Thanks so much
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!