• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using % sign within a scriptlet

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic