您的位置:首页 > 编程语言 > Java开发

javaweb学生管理系统-----查看个人信息功能实现

2020-07-17 12:32 120 查看
public class ViewProfileServlet extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

HttpSession httpSession=request.getSession();
Student student=new Student();

String stuId=(String)httpSession.getAttribute("stuId");//取出session中保存的id
student.setId(stuId);
//System.out.println(stuId);

StuDao stuDao=new StuDao();
Student student2=new Student();

student2=stuDao.getStudent(student);
//System.out.println(student2.toString());

httpSession.setAttribute("stu",student2);
request.getRequestDispatcher("/Profile.jsp").forward(request,response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐