资源简介
学生选课系统.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\me
文件 39 2019-05-15 15:18 瀛︾敓閫夎绯荤粺\WebContent\me
文件 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个文件信息
- 上一篇:XT30PW-M 3D.PcbLib
- 下一篇:DMP官方手册中文
相关资源
- zemax光学设计超级学习手册.rar
- 串口通信插件.txt
- KG.rar
- baidu云575.7M.txt
- 毕设嵌入式题目.txt
- UWB.zip
- RADARSAT_CSA.rar
- 硬盘助手v0.3.rar
- animations.rar
- ThinkpadE450黑苹果Clover包EFI包支持Inte
- cs0.zip
- .doc96542
- 徐小湛.txt
- 异步电机矢量控制系统仿真.rar
- zw_QT读数据绘制曲线.zip
- kitti转为VOC.zip
- 黑盾vip破解.txt
- WinArpAttacker3.70.zip
- 易图网终身会员获取,海量素材免费
- aD工具.rar
- .doc95368
- 流水线源码.zip
- arcgis10.7.txt
- 十万最新版敏感词.rar
- STBC.docx
- 数字边沿启动触发有限采样.vi
- 动态创建库V2.0.zip
- beijing地铁线路站点.rar
- BOOK.rar
- 二胎政策对中国人口的影响.pdf
评论
共有 条评论