我想处理在Java和JSP查询字符串的特殊字符(&“,”$,#,<,>)如何处理查询字符串中的特殊字符?
的Java:
String userName="abc&def>ghi<j#kl";
String url = "/app/ProductAction.do?userName="+userName+"&pwd=test123";
response.sendRedirect(url);
JSP:
<%
String userName="abc&def>ghi<j#kl";
String url = "/app/ProductAction.do?userName="+userName+"&pwd=test123";
%>
<a href="<%= url %>"> click here </a>
<a href="javscript:callUrl('<%= url %>')"> forward </a>
如何处理需要通过的所有这些特殊字符?