my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes How to handle '&' in a parameter value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to handle Watch "How to handle New topic
Author

How to handle '&' in a parameter value

Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
Hi

I am using AJAX to save a name value. This is my JS code in the JSP file:



In my servlet I simply extract the parameters and use them:



This works fine until user gives name like 'This & That' (anything that has an '&'). When this happens the servlet gets only the string before & (eg. 'This ')
This is happening because it thinks that there is another parameter due to occurrence of &.

Using & doesn't work too, because & comes there also.

Can someone please suggest how can I work around this?

Thanks in advance
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
check this link

may be help you.


Thanks,
Shailesh
Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
That worked Shailesh.

Thanks very much.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60755
    
  65

Please take the time to choose the correct forum for your posts. This forum is for questions on JSP.

For more information, please read this.

This post has been moved to a more appropriate forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Don't get me started about those stupid light bulbs.
 
subject: How to handle '&' in a parameter value
 
Similar Threads
Auto form submit with parameter from URL not working in IE
Dynamically Mapping Form Action with javascript
passing parameters to servlets
passing parameters from JSF to Java class and JSF to JSF
Call a number of servlets within the same session