资源简介

自己开发的基于SSH框架的高校学生选课系统,采用mysql数据库,附带数据库建表语句,直接复制运行即可使用

资源截图

代码片段和文件信息

package com.jwy.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction;

import com.jwy.dao.ICourseDao;
import com.jwy.dao.ISpecialtyDao;
import com.jwy.dto.Course;
import com.jwy.dto.Specialty;

/**
 * 
 * @author Jingweiyu 
 */
/**
 * 
 * @author Jingweiyu 
 */
public class CourseAction extends DispatchAction {

private ISpecialtyDao specialtyDao;
private ICourseDao courseDao;

/**
 * @param specialtyDao the specialtyDao to set
 */
public void setSpecialtyDao(ISpecialtyDao specialtyDao) {
this.specialtyDao = specialtyDao;
}
/**
 * @param courseDao the courseDao to set
 */
public void setCourseDao(ICourseDao courseDao) {
this.courseDao = courseDao;
}
public ActionForward insert(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response) {
DynaActionForm courseForm = (DynaActionForm) form;
Course course = new Course();
course.setName(courseForm.getString(“name“));
course.setSchooltime(courseForm.getString(“schooltime“));
course.setAddr(courseForm.getString(“addr“));
course.setCredit((Short)courseForm.get(“credit“));
course.setCourseInfo(courseForm.getString(“courseInfo“));
course.setTeacherName(courseForm.getString(“teacherName“));
course.setTeacherInfo(courseForm.getString(“teacherInfo“));
course.setIsFinish(true); //是否可以选课,默认为可以
course.setSpecialtyId((Integer)courseForm.get(“specialtyId“));
courseDao.insert(course);
return findBySearch(mapping courseForm request response);
}
public ActionForward updateIsFinish(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response) {
Integer id = Integer.valueOf(request.getParameter(“id“));
courseDao.updateIsFinish(id);
return courseInfo(mapping form request response);
}
public ActionForward findBySearch(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response) {
List sList = specialtyDao.findByAll();

Map map = new HashMap();
if(request.getParameter(“specialtyId“)!=null&&!request.getParameter(“specialtyId“).equals(“-1“)){
map.put(“specialtyId“ request.getParameter(“specialtyId“));
}
if(request.getParameter(“name“)!=null&&!request.getParameter(“name“).equals(““)){
map.put(“name“ request.getParameter(“name“));
}
if(request.getParameter(“teacherName“)!=null&&!request.getParameter(“teacherName“).equals(““)){
map.put(“teacherName“ request.getParameter(“teacherName“));
}

Listject> clist = courseDao.findBySearch(map);


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-05-07 12:22  courseSelection\
     文件        2511  2010-07-23 17:17  courseSelection\.classpath
     目录           0  2010-07-27 17:40  courseSelection\.myeclipse\
     文件         565  2010-07-23 17:17  courseSelection\.myhibernatedata
     文件         318  2010-07-27 20:31  courseSelection\.mymetadata
     文件         240  2010-07-23 17:17  courseSelection\.mystrutsdata
     文件        1914  2010-07-23 17:17  courseSelection\.project
     目录           0  2010-08-14 11:28  courseSelection\.settings\
     文件         406  2010-07-23 17:17  courseSelection\.settings\.jsdtscope
     文件          49  2010-07-23 17:17  courseSelection\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2010-07-23 17:17  courseSelection\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件         481  2010-07-23 17:17  courseSelection\.springBeans
     目录           0  2014-02-13 20:59  courseSelection\db_database26\
     文件          61  2010-07-27 20:39  courseSelection\db_database26\db.opt
     文件        8904  2010-07-27 20:40  courseSelection\db_database26\tb_course.frm
     文件         432  2010-07-27 20:40  courseSelection\db_database26\tb_course.MYD
     文件        2048  2010-07-27 20:40  courseSelection\db_database26\tb_course.MYI
     文件        8706  2010-07-27 20:40  courseSelection\db_database26\tb_specialty.frm
     文件          40  2010-07-27 20:40  courseSelection\db_database26\tb_specialty.MYD
     文件        2048  2010-07-27 20:40  courseSelection\db_database26\tb_specialty.MYI
     文件        8626  2010-07-27 20:40  courseSelection\db_database26\tb_stucourse.frm
     文件          65  2010-07-27 20:40  courseSelection\db_database26\tb_stucourse.MYD
     文件        2048  2010-07-27 20:40  courseSelection\db_database26\tb_stucourse.MYI
     文件        8836  2010-07-27 20:40  courseSelection\db_database26\tb_stuuser.frm
     文件         504  2010-07-27 20:40  courseSelection\db_database26\tb_stuuser.MYD
     文件        2048  2010-07-27 20:40  courseSelection\db_database26\tb_stuuser.MYI
     文件        8684  2010-07-27 20:40  courseSelection\db_database26\tb_userlogin.frm
     文件         344  2010-07-27 20:40  courseSelection\db_database26\tb_userlogin.MYD
     文件        2048  2010-07-27 20:40  courseSelection\db_database26\tb_userlogin.MYI
     目录           0  2014-02-13 20:59  courseSelection\src\
     目录           0  2010-08-14 11:28  courseSelection\src\com\
............此处省略150个文件信息

评论

共有 条评论