Java < = > JS

hi, i have a variable( string) in jsp. i want to pass that to my javascript. i did likevar x = <%=jspvar%>but it is not working. what is the possible way?Thanks.
[202 byte] By [_javaStudenta] at [2007-10-2 18:42:29]
# 1
what is the error?
jgalacambraa at 2007-7-13 20:04:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Hi,No error messages.i tried to alert the jsvalue. but failed.Thanks.
_javaStudenta at 2007-7-13 20:04:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

try this:

<%@ page contentType="text/html;charset=windows-1252"%>

<%String sampleStr="Hello World";%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>Hello World</title>

</head>

<body>

<script language="javascript">

var x = "<%=sampleStr%>";

alert(x);

</script>

</body>

</html>

jgalacambraa at 2007-7-13 20:04:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

> hi,

>

> i have a variable( string) in jsp. i want to pass

> that to my javascript. i did like

>

> var x = <%=jspvar%>

> but it is not working. what is the possible way?

> Thanks.

var x = '<%=jspvar%>' is working

Thanks

_javaStudenta at 2007-7-13 20:04:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
cheers:)
jgalacambraa at 2007-7-13 20:04:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
A hint: Mozilla/Firefox have a neat Javascript console.
BIJ001a at 2007-7-13 20:04:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...