(Try again) Value is truncated when using JSP getProperty() method on a form text field
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Gary_Epstein
Posted On:   Wednesday, July 25, 2001 03:27 PM

Probably a JSP 101 question, but here goes anyway. I am using the following code to set a value to a form text field:



value=' '>


When I try to set a value that contains a single quote, the value is being truncated at the point of the single quote.


For example, if I try to set the value "Charlie's Angels", only "Charlie" gets displayed in the text field.



Is there some encoding that is required? Thanks!

Re: (Try again) Value is truncated when using JSP getProperty() method on a form text field

Posted By:   Anonymous  
Posted On:   Wednesday, July 25, 2001 04:51 PM

The problem is that on the server side the tag will return a string and that string is sent to the client (browser). If the string contains a "'", then you will have:



As you can see, the browser will consider only "Charlie" to be the value.

I think that for fixing the problem, escaping the single quotes would be sufficient.

Regards.

About | Sitemap | Contact