[color=red]jsp:[/color]
<form action="UserServlet.do?method=login" name="form1" method="Post">
[color=red]web.xml:[/color]
<servlet>
<servlet-name>UserServlet</servlet-name>
<servlet-class>com.cms.servlet.UserServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UserServlet</servlet-name>
<url-pattern>/UserServlet.do</url-pattern>
</servlet-mapping>
[color=red]UserServlet:[/color]
protected void doPost([color=blue]HttpServletResponse response,HttpServletRequest request[/color]) throws ServletException, IOException {
doGet([color=blue]request,response[/color]);
}
protected void doGet([color=blue]HttpServletResponse response,HttpServletRequest request[/color]) throws ServletException, IOException{
String method =(String)request.getParameter("method");....
蓝色部分只有运行时才会报错。
<form action="UserServlet.do?method=login" name="form1" method="Post">
[color=red]web.xml:[/color]
<servlet>
<servlet-name>UserServlet</servlet-name>
<servlet-class>com.cms.servlet.UserServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UserServlet</servlet-name>
<url-pattern>/UserServlet.do</url-pattern>
</servlet-mapping>
[color=red]UserServlet:[/color]
protected void doPost([color=blue]HttpServletResponse response,HttpServletRequest request[/color]) throws ServletException, IOException {
doGet([color=blue]request,response[/color]);
}
protected void doGet([color=blue]HttpServletResponse response,HttpServletRequest request[/color]) throws ServletException, IOException{
String method =(String)request.getParameter("method");....
蓝色部分只有运行时才会报错。