• Post Reply Bookmark Topic Watch Topic
  • New Topic

javascript + JSP problem

 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
am doing
window.open(upgradeNE.jsp?productID=1&productName=UltraSite(1+1+1));
now in the JSP i have
request.getParameter("productName");
this is giving UltraSite(1 1 1)
How do i solve this problem. It's swallowing the "+"
thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65520
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to URL encode the request parameters. In a URL encoded string, the '+' character represents the space character, so your hard-coded pluses are turning into spaces.
Check out the URLEncoder class for more info.
If you can't do the encoding on the server-side while constructing the page, it'd be easy to write a JavaScript method that applied the same transforms.
hth,
bear
[ March 26, 2003: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!