Chainlu Sharma wrote:
>
> Hi
> I have a minor hitch in a HTML form generated thru servlet.[method=POST]
> One of the elements of the text field is 'TEXT'.
> The code for the same is
> <td bgcolor=#FFFFFF><INPUT TYPE=text name=\"Synopsis\" size=85 MAXLENGTH=79
>value='"+synopsis+"'></td>");
>
> where synopsis is the parameter/text entered by the user.
>
> The problem is :
> When the text contains singlequote('), on generating the page thru servlet the text
>upto the first occurence of ' is
> displayed.
> Soliciting urgent help in this regard.[ Really confused - the show stopper].
That's because you use single-quotes in your HTML to enclose the value. If
the value itself contains a single-quote, the browser interprets it as the
end of the value and ignores the rest. If you're absolutely sure the value
can never include a double-quote you could enclose the value in double-quotes
instead, i.e.
<td bgcolor=#FFFFFF><INPUT TYPE=text name=\"Synopsis\" size=85 MAXLENGTH=79
value=\""+synopsis+"\"></td>");
If the value can contain both single-quotes and double-quotes you need to
replace them with the corresponding HTML character code, i.e. ' and
" respectively, when you generate the <INPUT> tag.
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html