• Post Reply Bookmark Topic Watch Topic
  • New Topic

placing \" in the textfield causes error 500

 
John Bennet
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the textfield of any JSP page of the web application if one places \" it causes JSP to crash. Does anyone have ideas on this?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
Is the \" in the textfield as data when you write it out or as something the user enters?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
\ is an escape character. For it to be displayed properly, you need to use \\

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just like the rest of Java.
 
John Bennet
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone give me a sample of the code to check for \" in JavaScript since it seems to be in the client-side validation.
 
John Bennet
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I include a form_validation.js file to all the JSP's that I'm using. Do I have to include that .js file to the header of all JSP files. Is there a central place where I can include w/o having to mess with all the files?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
You can use the JavaScript match function to check for special characters. I think you want to search for the backslash, not just \". Example code is text.match(/\\/).

Also, there is no way to automatically include the javascript in all pages without touching the code. If you have a common header that you already include in all pages, you could add the javascript there though.
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Bennet:
How do I include a form_validation.js file to all the JSP's that I'm using. Do I have to include that .js file to the header of all JSP files. Is there a central place where I can include w/o having to mess with all the files?



Are you asking how to link to an external JavaScript file?


You can place this statement in the <head> section of your JSP. It has nothing to do with JSP includes though.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!