You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Eric W Hauser <eh...@indiana.edu> on 2004/05/04 00:34:47 UTC

Java String to Javascript String

Has anyone seen a tag library or some example code that will allow you to
grab an String from a scoped object and embed it as a Javascript string?
What I want to do is:

<script language="JavaScript" type="text/javascript">
function('blah', '${requestScope.attribute}');
</script>

This works fine until attribute contains a carriage return.  I haven't
tested this yet, but I believe if I was using JSP 1.2 it would
automatically insert a carriage return if I used <c:out /> instead of the
JSP 2.0 expression (which would also cause problems for Javascript).  I
hadn't thought of a good solution yet, so I figured I'd see if anyone had
already tackled this one.

-------------------
Eric Hauser
ehauser@indiana.edu
(317) 679-4766


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org