wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to handle Watch "How to handle New topic

How to handle '&' in a parameter value

Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146

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.

Abhishek Asthana
Ranch Hand

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

Thanks very much.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60794

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]
I agree. Here's the link: http://aspose.com/file-tools
subject: How to handle '&' in a parameter value
Similar Threads
Dynamically Mapping Form Action with javascript
Auto form submit with parameter from URL not working in IE
passing parameters to servlets
passing parameters from JSF to Java class and JSF to JSF
Call a number of servlets within the same session