Html 将表单中的url从页面传递到servlet会删除部分查询字符串
如果我在JSP上有这样一个表单:Html 将表单中的url从页面传递到servlet会删除部分查询字符串,html,jsp,url,Html,Jsp,Url,如果我在JSP上有这样一个表单: <form action = "/myApp/myServlet?rssFeedURL=${rssFeedURL}' />" method = "post"> <input type = "button" value = "See data for this RSS feed."/> </form> 但如果存在查询字符串,例如: http://news.google.com/news?ned=us&
<form action = "/myApp/myServlet?rssFeedURL=${rssFeedURL}' />" method = "post">
<input type = "button" value = "See data for this RSS feed."/>
</form>
但如果存在查询字符串,例如:
http://news.google.com/news?ned=us&topic=m&output=rss
我认为这与“&”字符的编码有关。有人能提供建议吗
服务器仅接收:
http://news.google.com/news?ned=us
我的页面是charset=UTF-8编码的。您需要对请求参数进行URL编码。否则,它们将被解释为初始请求URL的一部分 JSTL为此提供了
<c:url var="formActionURL" value="/myApp/myServlet">
<c:param name="rssFeedURL" value="${rssFeedURL}" />
</c:url>
<form action= "${formActionURL}" method="post">
...
...
另一种方法是创建一个EL函数,委托给
<c:url var="formActionURL" value="/myApp/myServlet">
<c:param name="rssFeedURL" value="${rssFeedURL}" />
</c:url>
<form action= "${formActionURL}" method="post">
...