下面这段代码输出的是url为
http://localhost:8080/news/HelloServlet?hello=%e5%a4%a7%e5%ae%b6%e5%a5%bd&test=%e5%a4%a7%e5%ae%b6%e5%a5%bd
其中<c:url value="http://localhost:8080/news/HelloServlet" var="url">
中的value为提交的url,var表示为url
<c:param name="hello" value="${hello}" />中的name为在下边引用的名字,如${hello},value为静态值,即显示的是${hello}中的hello,但会被转化为%百分号形式,避免url提交汉字出现乱码
这个设置还需要设置tomcat/conf/server.xml中的URLEncoder="urf-8"
黑色头发:http://heisetoufa.iteye.com/
http://localhost:8080/news/HelloServlet?hello=%e5%a4%a7%e5%ae%b6%e5%a5%bd&test=%e5%a4%a7%e5%ae%b6%e5%a5%bd
<body>
<c:url value="http://localhost:8080/news/HelloServlet" var="url">
<c:param name="hello" value="${hello}" />
<c:param name="test" value="${hello}" />
</c:url>
<a href="<c:out value="${url}" />">${hello}</a>
</body>
其中<c:url value="http://localhost:8080/news/HelloServlet" var="url">
中的value为提交的url,var表示为url
<c:param name="hello" value="${hello}" />中的name为在下边引用的名字,如${hello},value为静态值,即显示的是${hello}中的hello,但会被转化为%百分号形式,避免url提交汉字出现乱码
这个设置还需要设置tomcat/conf/server.xml中的URLEncoder="urf-8"
黑色头发:http://heisetoufa.iteye.com/