我的答案非常熟悉第一个答案。
mainPage.jsp
<html> <head> <title>Your Title Here</title> </head> <body> <form action="sample.jsp" method="POST"> <input type="text" id="firstname" name="firstname" /> <input type="submit" value="Submit" /> </form> </body></html>
sample.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><% String firstname = request.getParameter("firstname"); %>我也在使用apache tomcat。
您必须按照第一个答案中所述配置web.xml。
希望能有所帮助。



