package teacherActions;
import java.util.Collection;
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.actions.MappingDispatchAction;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import pojo.Score;
import pojo.Student;
import pojo.Teacher;
import service.StudentService;
import service.TeacherService;
public class TeacherAction extends MappingDispatchAction{
ApplicationContext ac =
new ClassPathXmlApplicationContext("applicationContext.xml");
TeacherService tservice =
(TeacherService) ac.getBean("teacherServiceImpl");
StudentService sservice =
(StudentService) ac.getBean("studentServiceImpl");
public ActionForward teachermessage(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
return mapping.findForward("success");
}
public ActionForward listself(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
return mapping.findForward("success");
}
public ActionForward modifyself(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
return mapping.findForward("success");
}
public ActionForward modifyselfImpl(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
request.setCharacterEncoding("gb2312");
String id=request.getParameter("id");
String name=request.getParameter("name");
String jiaoshihao=request.getParameter("username");
String password=request.getParameter("password");
String passwordsec=request.getParameter("passwordsec");
String age=request.getParameter("age");
String sex=request.getParameter("sex");
String title=request.getParameter("title");
String course=request.getParameter("course");
String info = this.test(name, jiaoshihao, password,passwordsec);
if (!info.equals("")) {
request.setAttribute("type", info);
return mapping.findForward("fail");
}
int id1=Integer.parseInt(id);
Teacher t=tservice.findTeacherById(id1);
t.setName(name);
t.setJiaoshihao(jiaoshihao);
t.setPassword(password);
t.setAge(age);
t.setSex(sex);
t.setTitle(title);
t.setCourse(course);
tservice.modifyTeacher(t);
return mapping.findForward("success");
}
public ActionForward scoreMgmt(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
return mapping.findForward("success");
}
public ActionForward addscore(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
int tid=(Integer) request.getSession().getAttribute("tid");
Teacher t=tservice.findTeacherById(tid);
String course=t.getCourse();
Collection<Student> students =tservice.findStudentByCourse(course);
request.setAttribute("students", students);
return mapping.findForward("success");
}
public ActionForward toaddscoreImpl(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String s=request.getQueryString();
String[]ss=s.split("=");
int id=Integer.parseInt(ss[1]);
Student student=sservice.findStudentById(id);
request.setAttribute("st", student);
return mapping.findForward("success");
}
public ActionForward addscoreImpl(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
request.setCharacterEncoding("gb2312");
String name=request.getParameter("name");
String xuehao=request.getParameter("xuehao");
String course=request.getParameter("course");
String point=request.getParameter("point");
Score score=sservice.queryPointByCourseandXuehao(course, xuehao);
if(score!=null){
String p=score.getPoint();
if(p!=null){
return mapping.findForward("fail");
}
}
Score s=new Score();
s.setCoursename(course);
s.setPoint(point);
s.setStudentname(name);
s.setXuehao(xuehao);
tservice.addscore(s);
Collection<Score> scores=tservice.listscore();
request.setAttribute("scores", scores);
return mapping.findForward("success");
}
public ActionForward modifyscore(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Collection<Score> scores=tservice.listscore();
request.setAttribute("scores", scores);
return mapping.findForward("success");
}
public ActionForward modifyscores(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String s=request.getQueryString();
String[] ss=s.split("=");
int id=Integer.parseInt(ss[1]);
Score score=tservice.findScoreById(id);
request.setAttribute("mscore", score);
return mapping.findForward("success");
}
public ActionForward modifyscoreImpl(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
request.setCharacterEncoding("gb2312");
String id=request.getParameter("id");
String studentname=request.getParameter("studentname");
String coursename=request.getParameter("coursename");
String xuehao=request.getParameter("xuehao");
String point=request.getParameter("point");
int id1=Integer.parseInt(id);
Score score=tservice.findScoreById(id1);
score.setCoursename(coursename);
score.setPoint(point);
score.setStudentname(studentname);
score.setXuehao(xuehao);
tservice.modifyscore(score);
Collection<Score> scores=tservice.listscore();
request.setAttribute("scores", scores);
return mapping.findForward("success");
}
public ActionForward queryscore(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Collection<Score> scores=tservice.listscore();
request.setAttribute("scores", scores);
return mapping.findForward("success");
}
public ActionForward removescore(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Collection<Score> scores=tservice.listscore();
request.setAttribute("scores", scores);
return mapping.findForward("success");
}
public ActionForward removescoreImpl(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
String s=request.getQueryString();
String[] ss=s.split("=");
int id=Integer.parseInt(ss[1]);
tservice.removescore(id);
Collection<Score> scores=tservice.listscore();
request.setAttribute("scores", scores);
return mapping.findForward("success");
}
public ActionForward listscore(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Collection<Score> scores=tservice.listscore();
request.setAttribute("scores", scores);
return mapping.findForward("success");
}
public String test(String name, String loginname, String loginpassword,
String passwordsec) {
String info = "";
String reg = "^([a-zA-Z0-9_-]|[0-9_-])+@([a-zA-Z0-9_-]|[0-9_-])+[.](((net)|(com)|(cn))|((com)+[.](cn)))$";
String reg1 = "^[a-zA-Z0-9]{2,12}$";
String reg3 = "^([a-zA-Z0-9]{2,8})|(\\W{2,3})$";
String reg2 = "^[0-9]{8,13}$";
if (lo
没有合适的资源?快使用搜索试试~ 我知道了~
简易教学管理系统(jsp+spring+struts+hibernate+mysql)
共156个文件
jsp:48个
java:25个
class:25个
4星 · 超过85%的资源 需积分: 10 35 下载量 59 浏览量
2009-05-17
14:44:55
上传
评论 3
收藏 395KB RAR 举报
温馨提示
简易教学管理系统(jsp+spring+struts+hibernate+mysql)
资源推荐
资源详情
资源评论
收起资源包目录
简易教学管理系统(jsp+spring+struts+hibernate+mysql) (156个子文件)
TeacherAction.class 8KB
StudentAction.class 6KB
StudentAction.class 6KB
TeacherAction.class 6KB
AdminAction.class 6KB
LoginAction.class 4KB
StudentDAOByHibernateImpl.class 4KB
TeacherDAOByHibernateImpl.class 4KB
StudentServiceImpl.class 3KB
TeacherServiceImpl.class 3KB
AdminDAOByHibernateImpl.class 3KB
Teacher.class 2KB
Student.class 2KB
AdminServiceImpl.class 2KB
Course.class 2KB
Admin.class 2KB
Score.class 1KB
RightAction.class 1KB
Modules.class 1KB
StudentService.class 1KB
StudentDAO.class 1KB
TeacherService.class 915B
TeacherDAO.class 912B
AdminService.class 557B
AdminDAO.class 551B
.classpath 843B
main.css 9KB
style.css 6KB
edit.css 654B
Thumbs.db 20KB
logo.gif 264KB
sy_04.gif 10KB
index_r3_c1new.gif 3KB
index_title_center2.gif 352B
TeacherAction.java 8KB
StudentAction.java 6KB
TeacherAction.java 6KB
AdminAction.java 6KB
StudentAction.java 6KB
LoginAction.java 4KB
StudentDAOByHibernateImpl.java 3KB
TeacherDAOByHibernateImpl.java 3KB
StudentServiceImpl.java 2KB
TeacherServiceImpl.java 2KB
AdminDAOByHibernateImpl.java 2KB
Teacher.java 2KB
Student.java 2KB
AdminServiceImpl.java 1KB
Course.java 1KB
Admin.java 1KB
Score.java 1KB
RightAction.java 1KB
StudentService.java 806B
StudentDAO.java 802B
TeacherDAO.java 722B
TeacherService.java 721B
Modules.java 648B
AdminService.java 433B
AdminDAO.java 429B
bg.jpg 32KB
channel_selfservices.jpg 15KB
channel_dh_2.jpg 13KB
ctitle_bak_right.jpg 13KB
btn_xx_right.jpg 13KB
subchannel_doc.jpg 13KB
ctitle_bak_center.jpg 13KB
ctitle_bak_fcenter.jpg 13KB
subchannel_bak.jpg 13KB
index_26.jpg 12KB
sy_13.jpg 10KB
sy_2_18.jpg 10KB
login.jpg 10KB
logo.jpg 8KB
imgcode.jpg 1KB
sy_10.jpg 780B
sy_12.jpg 704B
sy_03.jpg 543B
removeteacher.jsp 14KB
removestudent.jsp 14KB
tomodifyteacher.jsp 14KB
liststudent.jsp 13KB
tomodifystudent.jsp 13KB
listteacher.jsp 13KB
removeadmin.jsp 13KB
tomodifyadmin.jsp 13KB
listadmin.jsp 13KB
addstudent.jsp 13KB
listscore.jsp 12KB
addteacher.jsp 12KB
modifystudent.jsp 12KB
error.jsp 11KB
addadmin.jsp 11KB
modifyadmin.jsp 11KB
tomodifyscore.jsp 11KB
removescore.jsp 11KB
modifyteacher.jsp 11KB
listself.jsp 11KB
addscore.jsp 11KB
listself.jsp 11KB
modifyscore.jsp 10KB
共 156 条
- 1
- 2
guqinyun123
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页