Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 将表单中的url从页面传递到servlet会删除部分查询字符串_Html_Jsp_Url - Fatal编程技术网

Html 将表单中的url从页面传递到servlet会删除部分查询字符串

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&

如果我在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&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">
    ...