|
|
package web.servlet.teacher;
|
|
|
|
|
|
import javax.servlet.ServletException;
|
|
|
import javax.servlet.annotation.WebServlet;
|
|
|
import javax.servlet.http.HttpServlet;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
|
|
|
@WebServlet("/addSelectCourseServlet")
|
|
|
public class AddSelectCourseServlet extends HttpServlet {
|
|
|
|
|
|
// 处理POST请求的方法
|
|
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
|
// 设置请求字符编码为UTF-8,以支持中文字符
|
|
|
request.setCharacterEncoding("utf-8");
|
|
|
|
|
|
// 将请求转发到指定的JSP页面
|
|
|
// "/WEB-INF/teacher/addOptionalCourse.jsp" 是要转发到的JSP页面路径
|
|
|
request.getRequestDispatcher("/WEB-INF/teacher/addOptionalCourse.jsp").forward(request, response);
|
|
|
}
|
|
|
|
|
|
// 处理GET请求的方法
|
|
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
|
// 对于GET请求,调用doPost方法进行处理
|
|
|
doPost(request, response);
|
|
|
}
|
|
|
}
|
|
|
//public class AddSelectCourseServlet extends HttpServlet {
|
|
|
//
|
|
|
// // 处理POST请求的方法
|
|
|
// protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
|
// // 设置请求字符编码为UTF-8,以支持中文字符
|
|
|
// request.setCharacterEncoding("utf-8");
|
|
|
//
|
|
|
// // 将请求转发到指定的JSP页面
|
|
|
// // "/WEB-INF/teacher/addOptionalCourse.jsp" 是要转发到的JSP页面路径
|
|
|
// request.getRequestDispatcher("/WEB-INF/teacher/addOptionalCourse.jsp").forward(request, response);
|
|
|
// }
|
|
|
//
|
|
|
// // 处理GET请求的方法
|
|
|
// protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
|
// // 对于GET请求,调用doPost方法进行处理
|
|
|
// doPost(request, response);
|
|
|
// }
|
|
|
//}
|