假设我有 10 个按钮,在按下提交后我想发送该按钮的值来控制 servlet,我这样做了:
在 HTML 页面中
<body>
<form action="test" method="get">
<input type="button" name="dfhgdh" value="uiui" />
<input type="button" value="uiui" name="dfhgdh" />
<input type="button" value="dghdh" name="dfhgdh" />
<input type="button" value="dthydt" name="dfhgdh" />
<input type="submit" value="submit" name="fuyjuf" />
</form>
</body>
并在 Control-servlet
Protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String mn =request.getParameter("dfhgdh");
System.out.println(mn);
}
有没有人能说出哪里出了问题?