• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Textarea - ampersand problem

 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic