2024/02/25

<html>
<head>
    <title>Title</title>
</head>
<body>
<h1>${sessionScope.role}${sessionScope.User.id}</h1>
<br>
<%
    String role=(String) session.getAttribute("role");
    if(role.equals("stu"))
    {
        %>
    <a href="tiaoji-servlet">调剂申请</a>
<br>
    <a href="">查看调剂结果</a>
<br>
    <a href="tiaoji-servlet">浏览调剂计划</a>
<br>
    <a href="">复试申请</a>
<br>
    <a href="">查看复试结果</a>
<br>
    <a href="">成绩复查申请</a>
<br>
    <a href="">录取结果确认</a>
<%
    }
%>
</body>
</html>

 

package org.example.schooltest;

import DAO.SchoolDAO;
import bean.School;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(value="/tiaoji-servlet")
public class TiaoJiServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        List<School> SchoolList =new SchoolDAO().tiaojiyuanxiao();
        HttpSession session = request.getSession(); // 获取Session对象
        session.setAttribute("schoollist",SchoolList);
        response.sendRedirect("tiaoji.jsp");
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html");
        doGet(request,response);
    }
}

 

posted @ 2024-02-27 21:44  伐木工熊大  阅读(5)  评论(0编辑  收藏  举报