• 大小: 0.95M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: 其他
  • 标签: 其他  

资源简介

学生选课系统.zip

资源截图

代码片段和文件信息

package com;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class AddCourseServlet
 */
@WebServlet(description = “添加课程“ urlPatterns = { “/AddCourseServlet“ })
public class AddCourseServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
 * @see HttpServlet#HttpServlet()
 */
public AddCourseServlet() {
super();
// TODO Auto-generated constructor stub
}

/**
 * @see HttpServlet#doGet(HttpServletRequest request HttpServletResponse
 *      response)
 */
protected void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
// TODO Auto-generated method stub
// response.getWriter().append(“Served at: “).append(request.getContextPath());
doPost(request response);
}

/**
 * @see HttpServlet#doPost(HttpServletRequest request HttpServletResponse
 *      response)
 */
protected void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding(“UTF-8“);
response.setCharacterEncoding(“UTF-8“);
response.setContentType(“text/html;charset=UTF-8“);
response.setHeader(“Content-type“ “text/html;charset=UTF-8“);
String name = request.getParameter(“name“);
String nature = request.getParameter(“nature“);
String term = request.getParameter(“term“);
String teacher = request.getParameter(“teacher“);
String time = request.getParameter(“time“);
String room = request.getParameter(“room“);
int id = Integer.parseInt(request.getParameter(“id“));
int credit = Integer.parseInt(request.getParameter(“credit“));
int period = Integer.parseInt(request.getParameter(“period“));
PrintWriter writer = response.getWriter();
 writer.write(id+name+nature+term+credit+period+teacher);
// 实例化User对象,封装值
User user = new User();
user.setCname(name);
user.setCid(id);
user.setCredit(credit);
user.setNature(nature);
user.setPeriod(period);
user.setTeacher(teacher);
user.setTerm(term);
user.setRoom(room);
user.setTime(time);
// 实例化数据层操作
UserDAO userDao = new UserDAO();
if (userDao.AddCourse(id name nature term credit period teachertimeroom)) {
request.setAttribute(“msg“ “添加成功!“);
} else {
request.setAttribute(“msg“ “注册异常,课程已存在!“);
}
request.getRequestDispatcher(“addcourse.jsp“).forward(request response);
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-05-16 15:45  瀛︾敓閫夎绯荤粺\
     文件        6148  2019-05-26 14:35  瀛︾敓閫夎绯荤粺\.DS_Store
     目录           0  2019-07-08 21:08  __MACOSX\
     目录           0  2019-07-08 21:08  __MACOSX\瀛︾敓閫夎绯荤粺\
     文件         120  2019-05-26 14:35  __MACOSX\瀛︾敓閫夎绯荤粺\._.DS_Store
     目录           0  2019-05-18 15:43  瀛︾敓閫夎绯荤粺\WebContent\
     文件        2704  2019-05-18 15:19  瀛︾敓閫夎绯荤粺\WebContent\tindex.jsp
     文件        2899  2019-05-18 15:52  瀛︾敓閫夎绯荤粺\WebContent\addcourse.jsp
     文件        4744  2019-05-18 16:16  瀛︾敓閫夎绯荤粺\WebContent\teaadmin.jsp
     文件        2707  2019-05-18 12:50  瀛︾敓閫夎绯荤粺\WebContent\aindex.jsp
     文件        6148  2019-05-16 15:45  瀛︾敓閫夎绯荤粺\WebContent\.DS_Store
     目录           0  2019-07-08 21:08  __MACOSX\瀛︾敓閫夎绯荤粺\WebContent\
     文件         120  2019-05-16 15:45  __MACOSX\瀛︾敓閫夎绯荤粺\WebContent\._.DS_Store
     文件        6830  2019-05-18 14:52  瀛︾敓閫夎绯荤粺\WebContent\schedule.jsp
     文件        1122  2019-05-18 12:43  瀛︾敓閫夎绯荤粺\WebContent\exit.jsp
     文件        1190  2019-05-18 13:02  瀛︾敓閫夎绯荤粺\WebContent\shead.jsp
     文件        1684  2019-05-18 15:52  瀛︾敓閫夎绯荤粺\WebContent\adduser.jsp
     文件        4265  2019-05-18 15:52  瀛︾敓閫夎绯荤粺\WebContent\tpersonal.jsp
     文件        2704  2019-05-18 12:52  瀛︾敓閫夎绯荤粺\WebContent\sindex.jsp
     目录           0  2019-05-15 15:18  瀛︾敓閫夎绯荤粺\WebContent\meta-INF\
     文件          39  2019-05-15 15:18  瀛︾敓閫夎绯荤粺\WebContent\meta-INF\MANIFEST.MF
     文件        4263  2019-05-18 15:43  瀛︾敓閫夎绯荤粺\WebContent\personal.jsp
     文件        7290  2019-06-18 21:13  瀛︾敓閫夎绯荤粺\WebContent\courseadmin.jsp
     文件        3993  2019-05-18 15:52  瀛︾敓閫夎绯荤粺\WebContent\teachplan.jsp
     目录           0  2019-05-16 15:59  瀛︾敓閫夎绯荤粺\WebContent\img\
     文件        6148  2019-05-12 10:13  瀛︾敓閫夎绯荤粺\WebContent\img\.DS_Store
     目录           0  2019-07-08 21:08  __MACOSX\瀛︾敓閫夎绯荤粺\WebContent\img\
     文件         120  2019-05-12 10:13  __MACOSX\瀛︾敓閫夎绯荤粺\WebContent\img\._.DS_Store
     文件        7473  2019-05-12 10:12  瀛︾敓閫夎绯荤粺\WebContent\img\index.jpg
     文件        1476  2019-05-12 10:12  __MACOSX\瀛︾敓閫夎绯荤粺\WebContent\img\._index.jpg
     文件       10018  2019-04-07 16:52  瀛︾敓閫夎绯荤粺\WebContent\img\key.png
............此处省略67个文件信息

评论

共有 条评论