请大伙帮下忙`
jsp如何传递带引号的参数`  
window.location.href="update.jsp?updateid="+updateid
updateid的从数据库中取出的字符串 并且有些带有引号,
比如 "001"231  
     "002"232  
在update.jsp页面上 
String updateid=request.getParameter("updateid");
<textarea rows="4" name="descn" id="descn" cols="39" value="<%=updateid%>"></textarea>
这个value 怎么写才能得到正确字符串啊.

解决方案 »

  1.   

    <textarea rows="4" name="descn" id="descn" cols="39"><%=updateid%>></textarea> 
      

  2.   

    <textarea rows="4" name="descn" id="descn" cols="39" value='<%=updateid%>'> </textarea> 
    单引号就好了!
    我做实验
    <html>
    <head></head>
    <script type="text/javascript">
    function my(){
    var fuyou='"123"001';
    window.location.href="fuyou.jsp?fuyou="+fuyou;
    }
    </script>
    <body>

    <input type="button" onClick="my()" value="ss">
    </body>
    </html> <html>
    <head></head><body>

    <%
    String strs= request.getParameter("fuyou");out.println(strs);//打印出"123"001%>
    </body>
    <input type="text" value='<%=strs%>'><!-- 显示"123"001-->
    </html>
      

  3.   

    半角转成全角。
    String s = "".replace('"', '"'); 
      

  4.   

    updateid.replace("\"", "&quot;");
      

  5.   

    由于有特殊字符,所以要编码
    window.location.href="update.jsp?updateid="+〈%=java.net.URLEncoder.encode(updateid,"UTF-8");%〉 在update.jsp页面上 
    <%
    String updateid=request.getParameter("updateid");
    updateid=java.net.URLEncoder.encode(updateid,"UTF-8");//再次编码
    updateid="<script type=\'text/javascript\'>var s=encodeURIComponent("+updateid+")\;
    document.getElementsByTagName(\"textarea\")[0].value=s\;</script>";//js解码
    %>
    把赋值转移到上面的脚本中,下面就不用了
    <textarea rows="4" name="descn" id="descn" cols="39" value=" "> </textarea>