JavaBean类
package entity;
public class Student {
private boolean flag;//是否接受协议
public Student(){}
public boolean getFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
}
Servlet类
public class StudentServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Student student = new Student();
student.setFlag(false);
request.setAttribute("student", student);
request.getRequestDispatcher("student.jsp").forward(request, response);
}
}