Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Textbox String  RSS feed

Ranch Hand
Posts: 111
C++ jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a servlet that creates a html form with a textbox and a submit button. The form posts to the same servlet which in turn reverses the string entered in the textbox and creates the same form as before only now with the reversed text in the textbox. If the user presses the submit button again the reversed text should go back to what it was.
My servlet seems to work for all text except when a single quote is placed in the textbox and submitted. What happens is the text after a single quote gets reversed and sent back but cuts off the text that was before the single quote to begin with.
My guess that this happens is because I use s single quotes to set what the value of the textbox will be on the form. This is part of what I do in the code:
out.print( "<INPUT TYPE='TEXT' NAME='text' value='" );
//code to take in the string and reverse then print
out.print( "' size='50'>" );
Any Suggestions?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!