• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to handle special characters on JSP?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im using prepared statement to store data in database on a JSP (data is entered in a textbox). Im retrieving the data using <bean:write name='SomeForm' property='SomeProperty'/> on the same JSP to compare the values in the database and the textbox so that if someone is changing the data in textbox, and not saving it, and navigating away from the page, it should give an alert msg.
To compare, im using the following code:

The problem is, if I enter a data with special characters such as a double quote, the jsp converts the double quotes to & quot; (I put the space between & and q deliberately because it wont let me write it otherwise)
This is a mismatch, and even if the user has made no changes in the textbox value, the alert msg still comes up.
The text box contains the value G"DA. Database contains the value G"DA, but when I use <bean:write>, the HTML page contains G& quot;DA.
Please help.
 
Sheriff
Posts: 67746
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
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic