File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Textbox String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Textbox String" Watch "Textbox String" New topic
Author

Textbox String

Amber Woods
Ranch Hand

Joined: Mar 28, 2001
Posts: 111
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?
Amber


"Happiness is a way to Travel, <b>Not</b> a Destination" -- Unknown
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Textbox String
 
Similar Threads
Reverse2Servlet
Tag, you're it.
Dynamically created html textboxes in Java
servlet or jsp page with prefilled forms
Values in a text field