Javascript的语句体放在<%  %>标记对中就可以使用了。如
<script language=javascript>
  function show(arg) {
    <% String hello="hello world!";%>
    if(arg==1) {
       alert("<%=hello%>");
    }
  }
</script>
象这里的hello就是JSP的变量,可以在JS中使用。