how to assign jsp variable to javascript variable

In a Jsp page, within the javascript segment I am trying to assignJspString variable into javascript variable . For that I am using following code

<script language="javascript">

function getval()

{

<%String str="Sample Program";%>

var s=<%=str%>

alert(s);

}

</script>

But it is not working.

Kindly help me.

[399 byte] By [Muthiaha] at [2007-10-2 5:55:56]
# 1
what makes you think you don't need quotes around strings in Javascript? var s='<%=str%>';
bsampieria at 2007-7-16 2:05:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...