|
@@ -1,41 +0,0 @@
|
|
-package com.it.servlet;
|
|
|
|
-
|
|
|
|
-import java.io.IOException;
|
|
|
|
-import javax.servlet.ServletException;
|
|
|
|
-import javax.servlet.http.HttpServlet;
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-
|
|
|
|
-import com.it.bean.Course;
|
|
|
|
-import com.it.service.CourseService;
|
|
|
|
-import com.it.service.impl.CourseServiceImpl;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * Servlet implementation class CourseAddServlet
|
|
|
|
- */
|
|
|
|
-public class CourseAddServlet extends HttpServlet {
|
|
|
|
- private static final long serialVersionUID = 1L;
|
|
|
|
-
|
|
|
|
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
|
|
- request.setCharacterEncoding("UTF-8");
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- String discipline_name = request.getParameter("discipline_name");
|
|
|
|
- String course_name = request.getParameter("course_name");
|
|
|
|
-
|
|
|
|
- Course course = new Course(discipline_name, course_name);
|
|
|
|
-
|
|
|
|
- CourseService courseService = new CourseServiceImpl();
|
|
|
|
- courseService.insert(course);
|
|
|
|
-
|
|
|
|
- request.getRequestDispatcher("DisciplineListServlet").forward(request, response);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
|
|
- doGet(request, response);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-}
|
|
|