Hi,

this comes to mind but is probably not the correct
way!

StringTokenizer st = new StringTokenizer( s, "\n" );
String ss = "";
while( st.hasMoreTokens() ) {
  ss += st.nextToken() + "<br>";
}

something like that, then show ss in the jsp.

ron



--- david chan <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a JSP that retrive a string from database,
> the string may contain
> anykind of char. The problem is that when I assign
> the string to a variable
> in javascirpt then send this javascript code to
> browser, some special char.
> in the javascript will cause problem, i.e. the new
> line char. will cause the
> javascript variable broken.
> I can't use URLencode in here because I don't want
> to show the encoded
> string as plain text on browser. what i want is to
> have a mapping from char.
> to HTML sytax, i.e. new line will map to <br>.
> Does anyone have sample code for this ?
> Thanks.
> David
>
>
_________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com.
>
> Share information about yourself, create your own
> public profile at
> http://profiles.msn.com.
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> 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!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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