Hi,

Try adding a '\' before "\n" to escape the backslash, like this:

 String strMes="test\\ntest";

That'll do,

Luis Javier


----- Original Message -----
From: "Kulandaivadivel Duraisamy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 23, 2002 11:37 PM
Subject: "\n" problem in jsp


Hi All,

I have one String variable in jsp.
value of that variable contains "\n".

When I tried to give alert message of that varible's value(using java
script),i'm getting problem

for eg my jsp is

<%
 String strMes="test\ntest";
%>

<script language=javascript>
<%
out.println("alert(\""+strMes +"\");");
%>
</script>


once it is translated i'm getting html Output as


<script language=javascript>
alert("test
test");

</script>

Therefore it is showing error at line 2 .error is        " ) expected or
unterminated string constant".



but my desired output is

<script language=javascript>
alert("test\ntest");
</script>


Can anyone help me?

Thanks in advance

Vadivel

=========================
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to