use a bean for converting the double quotes into the appropriate html
character
like &376;.
a sample code
public String formatHTML(String arg){
if( arg == null || arg.length() == 0 ||
arg.trim().equalsIgnoreCase("null") )
return "";
StringBuffer result = new StringBuffer(arg.length());
char ch;
for(int i=0; i<arg.length(); i++){
ch = arg.charAt(i);
if(ch == '\'')
result.append("'");
else
if( ch == '"')
result.append(""");
else
if( ch == '<')
result.append("<");
else
if( ch == '>')
result.append(">");
else
if( ch == '&')
result.append("&");
else
result.append( ch );
}
return result.toString();
}
in your jsp page
give
<input type="text" value="myBean.formatHTML(value)">
The browser will take care of displaying the appropriate character.
Cheers
Nagarajan.
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Raghupathy, Gurumoorthy
Sent: Friday, October 19, 2001 10:15 AM
To: [EMAIL PROTECTED]
Subject: Re: Problem with double quotes
write a simple method which will convert " to \" and it will work.
guru
-----Original Message-----
From: Purav [mailto:[EMAIL PROTECTED]]
Sent: 19 October 2001 04:29
To: [EMAIL PROTECTED]
Subject: Problem with double quotes
Hi Guys,
How do I handle double quotes in my application.
Suppose you have a textbox for accepting the Full Name of the user, and the
user enters Purav " Parekh, then while retrieving the value from the
database, the text displayed in the textbox is only Purav as the double
quotes end the html tag.
IIS automatically converts double quotes to " , but not apache.
How do I take care of this. Is there any setting in the webserver or do I
have to handle this thru code.
Please Help
Purav
___________________________________________________________________________
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
___________________________________________________________________________
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