📄 queryteachinginformationaction.java
字号:
package action;
import java.io.*;
import java.util.*;
import vo.TeachingVO;
import dao.TeachingDAO;
import javax.servlet.*;
import javax.servlet.http.*;
import util.CharsetExchange;
public class QueryTeachingInformationAction extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException
{
String teacher_id=CharsetExchange.ISOToGB(request.getParameter("teachers"));
TeachingDAO teachingdao=new TeachingDAO();
boolean isexist=teachingdao.checkTeacher(teacher_id);
if(isexist)
{
ArrayList teachingInfors=new ArrayList();
teachingInfors=teachingdao.getTeachingByTeacherId(teacher_id);
HttpSession session=request.getSession(true);
session.setAttribute("teachingInfors",teachingInfors);
this.getServletContext().getRequestDispatcher("/QueryTeachingInformationResult.jsp").forward(request,response);
}
else
{
response.setContentType("text/html");
response.setCharacterEncoding("gb2312");
PrintWriter out=response.getWriter();
out.println("<html>");
out.println("<head><meta http-equiv=refresh content=2;url=QueryTeachingInformation.jsp>");
out.println("<title>查询教师任课信息</title></head>");
out.println("<body background=2.jpg>");
out.println("<br><br><br>");
out.println("<h1 align=center ><font color=red>对不起,该教师用户不存在,无法查询</font></h1><hr>");
out.println("<br><br>");
out.println("</body>");
out.println("</html>");
}
}
public void doPost(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException
{
doGet(request,response);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -