You need to run it through some sort of filter that should change the <"&>
characters to &lt; &quot; &amp; &gt; respectively.  Try put a method
something like this somewhere on your class path.

public class Convert {

  /**
   * Convert sensitive characters in a string to their XML equivalents
   *
   * @param str String to be Processed
   * @return XML ready String
   */
  public static String toXML (String str) {
    char[] in = str.toCharArray();
    StringBuffer out = new StringBuffer(in.length);
    for(int i = 0;i < in.length;i++) {
      switch(in[i]) {
        case '<':
          out.append("&lt;");
          break;
        case '>':
          out.append("&gt;");
          break;
        case '\"':
          out.append("&quot;");
          break;
        case '&':
          out.append("&amp;");
          break;
        default:
          out.append(in[i]);
          break;
      }
    }
    return out.toString();
  } //toXML
}

then change your tag to look like

<INPUT TYPE="text" VALUE="<%=Convert.toXML(description)%>">

(*Chris*)


----- Original Message -----
From: "Gianfrancesco Martinico"
<[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 16, 2001 8:37 AM
Subject: [JSP-INTEREST] Please Help me.


> I have to manage an html statement as below:
>
> <INPUT TYPE="text" VALUE="<%=description%>">
>
> where description contains the character " (i.e. description= abc "abc").
>
> When I show the html page, I can only see the string truncated at the
first " character (i.e. abc ).
> How can I visualize the whole string, including " character?
>
> Thank you.
>
> Francesco
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to