servletpackage servlet;import javax.servlet.http.HttpServlet

问题描述:

servlet
package servlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import java.io.*;
import bean.UserBean;
//用户注册
public class RegistServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException{
response.setContentType("text/html;charset=UTF-8");
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
UserBean user=new UserBean();
String name=request.getParameter("name");
String password=request.getParameter("password");
String trueName=request.getParameter("trueName");
String tel=request.getParameter("tel");
String address=request.getParameter("address");
user.setName(name);
user.setPassword(password);
user.setTrueName(trueName);
user.setTel(tel);
user.setAddress(address);
if(user.newUser(user))
{
RequestDispatcher dis=request.getRequestDispatcher("/index.jsp");
dis.forward(request,response);
}
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException{
doGet(request,response);
}
}
index.jsp
%@page contentType="text/html;charset=UTF-8"%>
订餐系统













用户名
密码

web.xml部分
UserLogon
servlet.UserServlet
UserLogon
/index.jsp
报错:message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).
tomcat版本:6.0.20
1个回答 分类:综合 2014-10-24

问题解答:

我来补答
/index.jsp
这两个不一致,淡然请求会出问题
 
 
展开全文阅读
剩余:2000
上一页:高数一指数函数
下一页:必修五第四单元