天天看點

GET方式請求表單的action屬性後不能帶參數

get方式送出請求form表單裡面的action裡帶了參數,背景一直無法取到

1

<form action="${pageContext.request.contextPath }/GetParameterServlet?method=hhhh" method="get">      

2

<input type="text" name="userName">      

3

<input type="submit" value="送出"/>      

4

</form>      

如果GET請求的表單action屬性中已經包含參數,浏覽器會直接将其過濾掉,再附加form表單裡資料。如下:

GET方式請求表單的action屬性後不能帶參數

隻有表單裡的實體參數跟在了uri後面,action中method=hhhh參數并沒有帶進去,servlet中request.getParameter("method")=null

繼續閱讀