package com.Servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.Util.DBUtil;
import bean.User;
/**
* Servlet implementation class Servlet
*/
@WebServlet("/Servlet")
public class Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Servlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.getWriter().append("Served at: ").append(request.getContextPath());
String id=request.getParameter("id");
String username=request.getParameter("username");
String password=request.getParameter("password");
String permissionid=request.getParameter("permissionid");
String job=request.getParameter("job");
String status=request.getParameter("status");
User user=new User();
if(request.getParameter("n").equals("downland"))
{
String username1=request.getParameter("username");
user.setUsername(username1);
String password1=request.getParameter("password");
user.setPassword(password1);
DBUtil.dengluchaxun(user);
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
package bean;
public class User {
protected int id;
protected String username;
protected String password;
protected String permissionid;
protected String job;
protected int status;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPermissionid() {
return permissionid;
}
public void setPermissionid(String permissionid) {
this.permissionid = permissionid;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}