if(num>0){
out.print("<script>alert('删除成功!');location.href='../listMsg.jsp';</script>");
}else{
out.print("<script>alert('删除失败!');location.href='../listMsg.jsp';</script>");
}
这就是代码,有一个参数需要传递,如何传递 ,传递过去了如何接收,被小脚本利用!!谢谢啦!!

解决方案 »

  1.   

    if(num>0){ 
    out.print(" <script>alert('删除成功!');location.href='../listMsg.jsp?name="value"'; </script>"); 
    }else{ 
    out.print(" <script>alert('删除失败!');location.href='../listMsg.jsp?name="value"'; </script>"); 

    在listMsg.jsp中request.getParamer("name")取
      

  2.   


    谢谢您的回答,但是:
    如果value是个变量呢,再jsp中传值是<%= 变量%>,因为<%%>起了冲突,我就给组合成一个字符串如:("<script>alert('');location.href='../listMsg.jsp?name=<%=变量%"+">';</script>")我这样写没有错吧!!
      

  3.   

    你说的很对
    (" <script>alert('');location.href='../listMsg.jsp?name= <%=变量%"+">'; </script>") 
    最好把变量先定义了,
    如下
    <%
      String name ="传递过来的值";
    %>
    (" <script>alert('');location.href='../listMsg.jsp?name= <%=name>>'; </script>") 
      

  4.   


    <%
    String    Name=request.getParameter("name");out.print("<script language='javascript'>location.href='/../listMsg.jsp?name="+Name+"';</script>");
    %>
      

  5.   

    大哥,手误location.href='/../listMsg.jsp? 你没发现多了一个/符号吗
      

  6.   

    可能网页复制过去编码有问题,你直接在你jsp上敲不就得了,方法没错的~~~~~注意如果你的name的value是中文的话是要注意编码转换