Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Textarea - ampersand problem  RSS feed

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My jsp form contains a textarea that submits to a servlet. When the textarea content includes an ampersand (&), the servlet is treating what comes after the & as a separate parameter.

How can I overcome this?

Thanks,
James
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's something you're not telling us.

Are you, for example, using Ajax? Because a "normal" form submission will handle this with no problems.
 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hiya Bear,

I hadn't realised, but the servlet template I had used obtained the parameters by doing...

BufferedReader paramsReader = request.getReader();
String paramsString = paramsReader.readLine();
String myParamValue = extractParamValueFromParamString("myParamName", paramsString);

The reason I'm using this technique is to overcome problems experienced with chunked encoding as the form data is very large and I have experienced problems obtaining parameter values before with such cases using the conventional request.getParameter() technique.

Temp solution to convert all "&"s in the request parameter values to "%26" works, but is there a better way??

Thanks,
James
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!