/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.sjtu.web.struts.action;
import com.sjtu.model.Paper;
import com.sjtu.model.Pq;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
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.DispatchAction;
import com.sjtu.common.Constants;
import com.sjtu.model.Question;
import com.sjtu.service.PaperService;
import com.sjtu.service.QuestionService;
import com.sjtu.service.impl.PaperServiceImpl;
import com.sjtu.service.impl.QuestionServiceImpl;
import com.sjtu.web.struts.form.MkpaperForm;
/**
* MyEclipse Struts
* Creation date: 05-26-2008
*
* XDoclet definition:
* @struts.action path="/exam" name="examForm" input="/exam.jsp" parameter="method" scope="request" validate="true"
*/
public class ExamAction extends DispatchAction {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward getPaper(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Long paperId = new Long(request.getParameter("paperId"));
request.getSession().setAttribute("paperId", paperId);
PaperService paperService = new PaperServiceImpl();
try{
List<Question> questionList = paperService.queryPaperContent(paperId);
request.setAttribute(Constants.QUESTION_LIST, questionList);
return mapping.findForward("getpaper");
}catch (SQLException e) {
System.out.println(e.getMessage());
return mapping.findForward("error");
}
}
public ActionForward makePaper(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
MkpaperForm mkpaperForm = (MkpaperForm) form;
PaperService paperService = new PaperServiceImpl();
Paper paper = new Paper();
paper.setPaperName(mkpaperForm.getName());
try {
Long paperId = paperService.mkPaper(paper);
request.getSession().setAttribute("paperId", paperId);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
QuestionService questionService = new QuestionServiceImpl();
List<Question> questionList = new ArrayList<Question>();
try {
questionList=questionService.queryAll();
request.setAttribute(Constants.QUESTION_LIST, questionList);
return mapping.findForward("allQAdd");
//System.out.println(Constants.QUESTION_LIST+"seeAll setAttribute = = = = == =");
} catch (SQLException e) {
System.out.println("seeAll = = = = == =");
e.printStackTrace();
}
return null;
}
public ActionForward addtoPaper(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
MkpaperForm mkpaperForm = (MkpaperForm) form;
Long questionId = new Long(request.getParameter("questionId"));
Long paperId = (Long)request.getSession().getAttribute("paperId");
System.out.println(paperId);
System.out.println(questionId);
PaperService paperService = new PaperServiceImpl();
Pq pq = new Pq();
pq.setPaperId(paperId);
pq.setQuestionId(questionId);
QuestionService questionService = new QuestionServiceImpl();
try {
paperService.addtoPaper(pq);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
List<Question> questionList = new ArrayList<Question>();
try {
questionList=questionService.queryAll();
request.setAttribute(Constants.QUESTION_LIST, questionList);
return mapping.findForward("allQAdd");
//System.out.println(Constants.QUESTION_LIST+"seeAll setAttribute = = = = == =");
} catch (SQLException e) {
System.out.println("seeAll = = = = == =");
e.printStackTrace();
}
return null;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
自己设计编写的课程大作业,一个简单的考试系统,有登陆,选题,答题,判分,查分,老师出卷子等功能。需要使用Myeclipse打开项目,并且用Tomcat服务器发布,之后就可以方便的在浏览器中http://localhost:8080/paser打开网站了。别的不多说了,我自己设计的,有利于初学者学习,不是很复杂。不是很华美,但是功能很真实的体现。
资源推荐
资源详情
资源评论
收起资源包目录
java web 案例 (162个子文件)
paser_010.backup 11KB
QuestionDAOImpl.class 5KB
ExamAction.class 4KB
PaperServiceImpl.class 4KB
PaperDAOImpl.class 3KB
PqDAOImpl.class 3KB
LoginAction.class 3KB
AddQAction.class 3KB
AnswerAction.class 3KB
UserDAOImpl.class 2KB
ExamLogImpl.class 2KB
AddQForm.class 2KB
Question.class 2KB
QuestionServiceImpl.class 1KB
DataSourceByJDBC.class 1KB
LoginForm.class 1KB
ExamLog.class 1KB
AnswerForm.class 1KB
MkpaperForm.class 1KB
PaperForm.class 1KB
User.class 986B
UserServiceImpl.class 877B
Paper.class 810B
Pq.class 736B
ExamLogServiceImpl.class 723B
PaperService.class 628B
BaseDAOImpl.class 591B
QuestionService.class 534B
Qid.class 505B
Constants.class 488B
QuestionDAO.class 484B
BaseServiceImpl.class 454B
PaperDAO.class 412B
PqDAO.class 366B
UserService.class 264B
ExamLogService.class 263B
ExamDAO.class 233B
UserDAO.class 223B
BaseService.class 120B
DAO.class 100B
.classpath 621B
mm_travel2.css 2KB
mm_lodging1.css 1KB
mm_product_sm.gif 464B
mm_arrow.gif 74B
mm_spacer.gif 43B
contact.html 4KB
tlogin.html 3KB
alogin.html 3KB
news.html 3KB
postgresql-8.2-504.jdbc3.jar 406KB
DDConnectionBroker.jar 13KB
ExamAction.java 4KB
QuestionDAOImpl.java 4KB
AddQAction.java 3KB
AddQForm.java 3KB
LoginAction.java 3KB
AnswerAction.java 3KB
PaperServiceImpl.java 2KB
PaperDAOImpl.java 2KB
PqDAOImpl.java 2KB
LoginForm.java 2KB
DataSourceByJDBC.java 2KB
AnswerForm.java 1KB
MkpaperForm.java 1KB
PaperForm.java 1KB
Question.java 1KB
UserDAOImpl.java 1KB
ExamLogImpl.java 1KB
QuestionServiceImpl.java 919B
ExamLog.java 643B
PaperService.java 581B
User.java 556B
UserServiceImpl.java 526B
QuestionService.java 483B
ExamLogServiceImpl.java 463B
QuestionDAO.java 445B
Paper.java 422B
Pq.java 366B
PaperDAO.java 350B
PqDAO.java 315B
BaseDAOImpl.java 296B
Constants.java 273B
BaseServiceImpl.java 237B
ExamLogService.java 233B
UserDAO.java 221B
ExamDAO.java 210B
UserService.java 207B
Qid.java 168B
BaseService.java 66B
DAO.java 54B
f0508004.jpg 2.08MB
paserstruts.jpg 1.38MB
f05.jpg 183KB
0508004.jpg 179KB
pintu2.jpg 179KB
menshen.jpg 60KB
cxd.jpg 42KB
sqf.jpg 37KB
sy.jpg 30KB
共 162 条
- 1
- 2
资源评论
- hony2013-01-11对我这样的初学者太有用了,谢谢!
- huangxiaosan19912012-04-27案例很实用,但是还是有功能缺陷。
songqingfeng333
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- welearn刷时长版本v3.0.bat
- 前端分析-2023071100789-y5
- 前端分析-2023071100789
- 调查问卷系统源代码全套技术资料.zip
- 环境监测系统源代码全套技术资料.zip
- SDUT linux期末理论题题库+大题复习资料+7次实验报告
- 前端分析-2023071100789
- 前端分析-2023071100789
- 基于springboot的调查问卷管理系统源代码全套技术资料.zip
- MATLAB代码:计及碳排放交易及多种需求响应的微网 电厂日前优化调度 关键词:碳排放交易 需求响应 空调负荷 电动汽车 微网 电厂优化调度 参考文档:计及电动汽车和需求响应的多类电力市场下
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功