首页>代码>基于jsp+servlet的idea版学生管理系统,前端框架layui>/studentManage/源码/studentManage/src/main/java/controller/StudentAllInfoServlet.java
package controller;

import domain.Student;
import domain.StudentAllInfo;
import service.StudentAllInfoService;
import service.impl.StudentAllInfoServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@WebServlet(name = "studentAllInfoServlet",urlPatterns = {"/studentAllInfo"})
public class StudentAllInfoServlet extends BaseServlet{

    private StudentAllInfoService studentAllInfoService=new StudentAllInfoServiceImpl();

    public void studentAllInfo(HttpServletRequest request, HttpServletResponse response) throws Exception{
        List<StudentAllInfo> studentAllInfoList = studentAllInfoService.studentAllInfo();
        System.out.println(studentAllInfoList);
        if (studentAllInfoList != null) {
            request.setAttribute("studentAllInfoList", studentAllInfoList);
        } else {
            request.setAttribute("msg", "无数据");
        }
        request.getRequestDispatcher("/pages/studentAllInfo/studentAllInfo.jsp").forward(request, response);
    }

    public void findStudentAllInfoById(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String id=request.getParameter("id");
        StudentAllInfo studentAllInfo = studentAllInfoService.findStudentAllInfoById(id);
        if (studentAllInfo!=null) {
            request.setAttribute("student",studentAllInfo);
        } else {
            request.setAttribute("stuMsgError","查询失败,可能无id");
        }
        request.getRequestDispatcher("/pages/studentAllInfo/singleStudentInfo.jsp").forward(request, response);
    }
}
最近下载更多
ZzzxzzZ  LV6 前天
zhaipengfei  LV2 3月3日
ma406805131  LV19 2024年12月27日
120_wu  LV4 2024年12月2日
李清清  LV2 2024年11月6日
xiao小果  LV13 2024年8月19日
破剑茶寮  LV4 2024年6月26日
15719908287  LV9 2024年6月19日
TY0165  LV20 2024年6月18日
微信网友_7024879466991616  LV2 2024年6月14日
最近浏览更多
ZzzxzzZ  LV6 前天
zhaipengfei  LV2 3月3日
暂无贡献等级
kkkxyh  LV13 2月11日
dongandmin  LV8 2024年12月27日
ma406805131  LV19 2024年12月26日
120_wu  LV4 2024年12月2日
haomc052829  LV4 2024年11月18日
李清清  LV2 2024年11月6日
yimaoermao  LV1 2024年9月14日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友