File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 61773
    
  67

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