资源简介

灰常简单的Java学生成绩管理系统 效果展示:http://www.cnblogs.com/wenruo/p/6351787.html

资源截图

代码片段和文件信息

package com.wenr.controller;

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

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.wenr.dao.CourseDao;
import com.wenr.dao.StudentDao;
import com.wenr.model.Course;
import com.wenr.model.Student;

public class AdminServlet extends HttpServlet {

/**
 * Constructor of the object.
 */
public AdminServlet() {
super();
}

/**
 * Destruction of the servlet. 

 */
public void destroy() {
super.destroy(); // Just puts “destroy“ string in log
// Put your code here
}

/**
 * The doGet method of the servlet. 

 *
 * This method is called when a form has its tag value method equals to get.
 * 
 * @param request the request send by the client to the server
 * @param response the response send by the server to the client
 * @throws ServletException if an error occurred
 * @throws IOException if an error occurred
 */
public void doGet(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {
doPost(requestresponse);
}

/**
 * The doPost method of the servlet. 

 *
 * This method is called when a form has its tag value method equals to post.
 * 
 * @param request the request send by the client to the server
 * @param response the response send by the server to the client
 * @throws ServletException if an error occurred
 * @throws IOException if an error occurred
 */
public void doPost(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {
request.setCharacterEncoding(“utf-8“);
response.setContentType(“text/html;charset=utf-8“);

String action = request.getParameter(“action“);
String path = request.getContextPath();
HttpSession session = request.getSession();
PrintWriter out = response.getWriter();

CourseDao courseDao = new CourseDao();

if (“delete“.equals(action)) {
// 删除课程
courseDao.deleteCourseById(Integer.parseInt(request.getParameter(“cid“)));
   response.sendRedirect(“../adminSearchCourse.jsp“);
} else if (“update“.equals(action)) {
// 更新课程
Course course = new Course();
course.setCid(Integer.parseInt(request.getParameter(“cid“)));
course.setCname(request.getParameter(“cname“));
course.setCredit(Integer.parseInt(request.getParameter(“credit“)));
courseDao.updateCourse(course);
   response.sendRedirect(“../adminSearchCourse.jsp“);
} else if (“addStudent“.equals(action)) {
Student student = new Student();
StudentDao studentDao = new StudentDao();
   student.setSpwd(request.getParameter(“spwd“));
   student.setSname(request.getParameter(“sname“));
studentDao.addStudent(student);
response.sendRedirect(“../adminAddStudent.jsp“); 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-01-25 15:18  StudentAchievementManagementSystem\
     文件        1093  2017-01-25 15:18  StudentAchievementManagementSystem\.classpath
     文件        1084  2017-01-25 15:18  StudentAchievementManagementSystem\.project
     目录           0  2017-01-26 20:18  StudentAchievementManagementSystem\.settings\
     文件         564  2017-01-25 15:18  StudentAchievementManagementSystem\.settings\.jsdtscope
     文件          74  2017-01-26 20:18  StudentAchievementManagementSystem\.settings\org.eclipse.core.resources.prefs
     文件         364  2017-01-25 15:18  StudentAchievementManagementSystem\.settings\org.eclipse.jdt.core.prefs
     文件         561  2017-01-25 15:18  StudentAchievementManagementSystem\.settings\org.eclipse.wst.common.component
     文件         414  2017-01-25 15:18  StudentAchievementManagementSystem\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-01-25 15:18  StudentAchievementManagementSystem\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-01-25 15:18  StudentAchievementManagementSystem\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-01-26 19:00  StudentAchievementManagementSystem\src\
     目录           0  2017-01-25 15:19  StudentAchievementManagementSystem\src\com\
     目录           0  2017-01-26 19:43  StudentAchievementManagementSystem\src\com\wenr\
     目录           0  2017-01-26 17:35  StudentAchievementManagementSystem\src\com\wenr\controller\
     文件        3500  2017-01-26 16:58  StudentAchievementManagementSystem\src\com\wenr\controller\AdminServlet.java
     文件        1827  2017-01-26 17:43  StudentAchievementManagementSystem\src\com\wenr\controller\LoginFilter.java
     文件        4896  2017-01-26 17:41  StudentAchievementManagementSystem\src\com\wenr\controller\LoginServlet.java
     文件        5015  2017-01-26 15:41  StudentAchievementManagementSystem\src\com\wenr\controller\StudentServlet.java
     目录           0  2017-01-26 14:29  StudentAchievementManagementSystem\src\com\wenr\dao\
     文件        4801  2017-01-26 15:20  StudentAchievementManagementSystem\src\com\wenr\dao\CourseDao.java
     文件        6644  2017-01-25 15:53  StudentAchievementManagementSystem\src\com\wenr\dao\StudentDao.java
     目录           0  2017-01-25 15:26  StudentAchievementManagementSystem\src\com\wenr\model\
     文件         629  2017-01-25 15:30  StudentAchievementManagementSystem\src\com\wenr\model\Course.java
     文件         472  2017-01-25 15:24  StudentAchievementManagementSystem\src\com\wenr\model\Student.java
     目录           0  2017-01-25 15:40  StudentAchievementManagementSystem\src\com\wenr\util\
     文件         780  2017-01-25 15:41  StudentAchievementManagementSystem\src\com\wenr\util\DBUtil.java
     目录           0  2017-01-26 17:31  StudentAchievementManagementSystem\WebRoot\
     文件        1992  2017-01-26 16:49  StudentAchievementManagementSystem\WebRoot\adminAddCourse.jsp
     文件        1582  2017-01-26 16:54  StudentAchievementManagementSystem\WebRoot\adminAddStudent.jsp
     文件        1354  2017-01-26 15:47  StudentAchievementManagementSystem\WebRoot\adminMain.jsp
............此处省略41个文件信息

评论

共有 条评论