<form action="servlet/ThirdServlet?userName=1&passWord=2" method="post">
<input type="submit" value="提交">
</form>
public class ThirdServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String userName = request.getParameter("uesrName");
String passWord = request.getParameter("passWord");
response.getWriter().println("userName --->"+userName);
response.getWriter().println("passWord---->"+passWord);
}
}
为什么passWord能取到值,而userName取不到值得?
------解决方案--------------------
String userName = request.getParameter("uesrName");
你的userName写错了,这种情况最好复制粘贴。。。