js里要用到jsp里的变量时,加上<%...%>就是了!

解决方案 »

  1.   

    调用时这样写:
           
              
           <%String str1,str2;
               //从数据库中得到多个str1,str2
             //在此项调用  drawline(str1,str2)
             out.println("<script>");
             out.println("drawline("+str1+","+str2+")")
             out.println("</script>");
            %>
        <script>
           function drawline(str1,str2)
            {
              //函数的内容
            }
       </script>
       这样就可以调用了。