├── .gitignore
├── _config.yml
├── .settings
├── org.eclipse.wst.jsdt.ui.superType.name
├── org.eclipse.wst.jsdt.ui.superType.container
├── org.eclipse.wst.validation.prefs
├── org.eclipse.m2e.core.prefs
├── org.eclipse.core.resources.prefs
├── org.eclipse.wst.common.project.facet.core.xml
├── org.eclipse.jdt.core.prefs
├── .jsdtscope
└── org.eclipse.wst.common.component
├── screenshots
├── db_design1.png
├── db_design2.png
├── screenshot_chart1.png
├── screenshot_chart2.png
├── screenshot_chart3.png
├── screenshot_exam1.png
├── screenshot_nologin.png
├── screenshot_compose1.png
├── screenshot_compose2.png
├── screenshot_examlist.png
├── screenshot_adminlogin.png
└── screenshot_importdata.png
├── src
└── main
│ ├── webapp
│ ├── testcss.jsp
│ ├── images
│ │ ├── bkgd.png
│ │ ├── img4.jpg
│ │ ├── favicon.ico
│ │ ├── minus1.png
│ │ ├── plus1.png
│ │ ├── soccer4.jpg
│ │ ├── wrong.png
│ │ ├── bar_stats1.png
│ │ ├── bar_stats2.png
│ │ ├── bar_stats3.png
│ │ ├── categories2.jpg
│ │ ├── datastats2.png
│ │ ├── exampaper2.jpg
│ │ ├── program009.png
│ │ ├── program017.png
│ │ ├── program018.png
│ │ ├── program019.png
│ │ ├── program020.png
│ │ ├── program035.png
│ │ ├── program036.png
│ │ ├── program040.png
│ │ ├── program043.png
│ │ ├── program044.png
│ │ ├── program045.png
│ │ ├── program048.png
│ │ ├── program105.png
│ │ ├── program106.png
│ │ ├── program107.png
│ │ ├── program108.png
│ │ ├── program202.png
│ │ ├── program203.png
│ │ ├── program205.png
│ │ ├── program206.png
│ │ ├── program207.png
│ │ ├── program208.png
│ │ ├── program301.png
│ │ ├── program302.png
│ │ ├── program303.png
│ │ ├── program304.png
│ │ ├── program305.png
│ │ ├── program306.png
│ │ ├── program307.png
│ │ ├── program308.png
│ │ ├── program309.png
│ │ ├── program310.png
│ │ ├── program311.png
│ │ ├── program312.png
│ │ ├── program313.png
│ │ ├── program314.png
│ │ ├── program315.png
│ │ ├── program316.png
│ │ ├── program317.png
│ │ ├── program318.png
│ │ ├── program319.png
│ │ ├── program320.png
│ │ ├── program321.png
│ │ ├── program401.png
│ │ ├── program402.png
│ │ ├── program403.png
│ │ ├── program404.png
│ │ ├── program405.png
│ │ ├── program406.png
│ │ ├── program407.png
│ │ ├── program501.png
│ │ ├── program502.png
│ │ ├── program503.png
│ │ ├── program504.png
│ │ ├── program505.png
│ │ ├── program506.png
│ │ ├── program507.png
│ │ ├── program508.png
│ │ ├── blankquestion1.jpg
│ │ ├── importexport2.jpg
│ │ ├── judgequestion1.jpg
│ │ ├── questiontype2.jpg
│ │ ├── choicequestion1.jpg
│ │ └── papergenerator2.jpg
│ ├── fonts
│ │ ├── materialicons.woff2
│ │ ├── roboto
│ │ │ ├── Roboto-Bold.eot
│ │ │ ├── Roboto-Bold.ttf
│ │ │ ├── Roboto-Thin.eot
│ │ │ ├── Roboto-Thin.ttf
│ │ │ ├── Roboto-Bold.woff
│ │ │ ├── Roboto-Bold.woff2
│ │ │ ├── Roboto-Light.eot
│ │ │ ├── Roboto-Light.ttf
│ │ │ ├── Roboto-Light.woff
│ │ │ ├── Roboto-Medium.eot
│ │ │ ├── Roboto-Medium.ttf
│ │ │ ├── Roboto-Thin.woff
│ │ │ ├── Roboto-Thin.woff2
│ │ │ ├── Roboto-Light.woff2
│ │ │ ├── Roboto-Medium.woff
│ │ │ ├── Roboto-Medium.woff2
│ │ │ ├── Roboto-Regular.eot
│ │ │ ├── Roboto-Regular.ttf
│ │ │ ├── Roboto-Regular.woff
│ │ │ └── Roboto-Regular.woff2
│ │ └── material-design-icons
│ │ │ ├── Material-Design-Icons.eot
│ │ │ ├── Material-Design-Icons.ttf
│ │ │ ├── Material-Design-Icons.woff
│ │ │ └── Material-Design-Icons.woff2
│ ├── webfonts
│ │ ├── fa-solid-900.eot
│ │ ├── fa-solid-900.ttf
│ │ ├── fa-brands-400.eot
│ │ ├── fa-brands-400.ttf
│ │ ├── fa-brands-400.woff
│ │ ├── fa-brands-400.woff2
│ │ ├── fa-regular-400.eot
│ │ ├── fa-regular-400.ttf
│ │ ├── fa-regular-400.woff
│ │ ├── fa-solid-900.woff
│ │ ├── fa-solid-900.woff2
│ │ └── fa-regular-400.woff2
│ ├── other
│ │ ├── 判断题import.txt
│ │ ├── 填空题import.txt
│ │ ├── 选择题import.txt
│ │ ├── 学生import.txt
│ │ ├── 判断题_import_20170404.txt
│ │ ├── 2016级电商3班_学生51人_import.txt
│ │ ├── 填空题_import_20170404.txt
│ │ └── 选择题_import_20170404.txt
│ ├── all.jsp
│ ├── test.jsp
│ ├── include
│ │ └── footer.jsp
│ ├── css
│ │ ├── material_icons.css
│ │ └── jquery.jOrgChart.lyq.css
│ ├── WEB-INF
│ │ └── web.xml
│ ├── examHandIn.jsp
│ ├── blankFillingDetail.jsp
│ ├── judgeDetail.jsp
│ ├── changeSettings.jsp
│ ├── examDetail.jsp
│ ├── broadcastMessage.jsp
│ ├── examList.jsp
│ ├── questionByKnowledge.jsp
│ ├── choiceDetail.jsp
│ ├── examComposeTypes.jsp
│ └── examSummary.jsp
│ ├── resources
│ ├── mysetting.properties
│ ├── import
│ │ ├── 判断题import.txt
│ │ ├── 选择题import2.txt
│ │ ├── 填空题import.txt
│ │ ├── 选择题import.txt
│ │ └── 学生import.txt
│ ├── log4j2.xml
│ └── applicationContext.xml
│ └── java
│ └── cn
│ └── lynu
│ └── lyq
│ └── java_exam
│ ├── common
│ ├── FileLocation.java
│ ├── QuestionType.java
│ ├── ExamPhase.java
│ └── Constants.java
│ ├── dao
│ ├── GradeDao.java
│ ├── ExamStrategyDao.java
│ ├── StudentDao.java
│ ├── ExamQuestionDao.java
│ ├── ExamDao.java
│ ├── StudentExamScoreDao.java
│ ├── ExamQuestionAnswerDao.java
│ ├── BankQuestionDao.java
│ └── impl
│ │ ├── GradeDaoImpl.java
│ │ ├── ExamStrategyDaoImpl.java
│ │ ├── ExamQuestionAnswerDaoImpl.java
│ │ └── ExamQuestionDaoImpl.java
│ ├── test
│ ├── ExamPhaseTest.java
│ ├── CustomRenderer.java
│ ├── BlankFillingTest1.java
│ ├── BubbleSort.java
│ ├── JFreeChartTest1.java
│ ├── BarChartTest.java
│ └── WordGernerateTest1.java
│ ├── websocket
│ ├── GetHttpSessionConfigurator.java
│ └── BroadcastServer.java
│ ├── entity
│ ├── BankJudgeQuestion.java
│ ├── Grade.java
│ ├── Exam.java
│ ├── ExamQuestionAnswer.java
│ ├── Student.java
│ ├── BankQuestion.java
│ ├── ExamStrategy.java
│ ├── StudentExamScore.java
│ ├── ExamQuestion.java
│ ├── BankBlankFillingQuestion.java
│ └── BankChoiceQuestion.java
│ ├── misc
│ └── CustomColorBarRenderer.java
│ ├── utils
│ ├── QuestionUtils.java
│ └── PropertyUtils.java
│ ├── actions
│ ├── QuestionStatsAction.java
│ ├── SimpleTestAction.java
│ ├── JudgeDetailAction.java
│ ├── ExamListShowAction.java
│ ├── BlankFillingDetailAction.java
│ ├── UpdateStrategyNameAction.java
│ ├── PushBroadcastMessageAction.java
│ ├── UserLoginAction.java
│ ├── UpdateStrategyScoreAction.java
│ ├── StudentImportAction.java
│ ├── ChoiceDetailAction.java
│ ├── ModifySettingsAction.java
│ ├── UserChangePasswordAction.java
│ ├── ExamScoreListAction.java
│ ├── JudgeQuestionSearchAction.java
│ ├── BlankQuestionSearchAction.java
│ └── ScoreStatsAction.java
│ └── filters
│ └── JspFilter.java
├── .project
├── README.md
└── .classpath
/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | .idea
3 | .iml
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-slate
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.jsdt.ui.superType.name:
--------------------------------------------------------------------------------
1 | Window
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.jsdt.ui.superType.container:
--------------------------------------------------------------------------------
1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.validation.prefs:
--------------------------------------------------------------------------------
1 | disabled=06target
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/screenshots/db_design1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/db_design1.png
--------------------------------------------------------------------------------
/screenshots/db_design2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/db_design2.png
--------------------------------------------------------------------------------
/src/main/webapp/testcss.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/main/webapp/images/bkgd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/bkgd.png
--------------------------------------------------------------------------------
/src/main/webapp/images/img4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/img4.jpg
--------------------------------------------------------------------------------
/screenshots/screenshot_chart1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_chart1.png
--------------------------------------------------------------------------------
/screenshots/screenshot_chart2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_chart2.png
--------------------------------------------------------------------------------
/screenshots/screenshot_chart3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_chart3.png
--------------------------------------------------------------------------------
/screenshots/screenshot_exam1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_exam1.png
--------------------------------------------------------------------------------
/screenshots/screenshot_nologin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_nologin.png
--------------------------------------------------------------------------------
/src/main/webapp/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/favicon.ico
--------------------------------------------------------------------------------
/src/main/webapp/images/minus1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/minus1.png
--------------------------------------------------------------------------------
/src/main/webapp/images/plus1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/plus1.png
--------------------------------------------------------------------------------
/src/main/webapp/images/soccer4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/soccer4.jpg
--------------------------------------------------------------------------------
/src/main/webapp/images/wrong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/wrong.png
--------------------------------------------------------------------------------
/screenshots/screenshot_compose1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_compose1.png
--------------------------------------------------------------------------------
/screenshots/screenshot_compose2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_compose2.png
--------------------------------------------------------------------------------
/screenshots/screenshot_examlist.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_examlist.png
--------------------------------------------------------------------------------
/screenshots/screenshot_adminlogin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_adminlogin.png
--------------------------------------------------------------------------------
/screenshots/screenshot_importdata.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/screenshots/screenshot_importdata.png
--------------------------------------------------------------------------------
/src/main/webapp/images/bar_stats1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/bar_stats1.png
--------------------------------------------------------------------------------
/src/main/webapp/images/bar_stats2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/bar_stats2.png
--------------------------------------------------------------------------------
/src/main/webapp/images/bar_stats3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/bar_stats3.png
--------------------------------------------------------------------------------
/src/main/webapp/images/categories2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/categories2.jpg
--------------------------------------------------------------------------------
/src/main/webapp/images/datastats2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/datastats2.png
--------------------------------------------------------------------------------
/src/main/webapp/images/exampaper2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/exampaper2.jpg
--------------------------------------------------------------------------------
/src/main/webapp/images/program009.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program009.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program017.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program017.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program018.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program018.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program019.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program019.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program020.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program020.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program035.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program035.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program036.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program036.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program040.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program040.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program043.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program043.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program044.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program044.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program045.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program045.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program048.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program048.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program105.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program105.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program106.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program106.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program107.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program107.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program108.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program108.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program202.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program202.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program203.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program203.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program205.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program205.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program206.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program206.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program207.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program207.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program208.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program208.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program301.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program301.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program302.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program302.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program303.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program303.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program304.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program304.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program305.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program305.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program306.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program306.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program307.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program307.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program308.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program308.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program309.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program309.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program310.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program311.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program311.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program312.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program312.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program313.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program313.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program314.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program314.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program315.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program315.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program316.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program316.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program317.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program317.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program318.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program318.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program319.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program319.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program320.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program320.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program321.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program321.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program401.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program401.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program402.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program402.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program403.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program403.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program404.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program404.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program405.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program405.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program406.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program406.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program407.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program407.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program501.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program501.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program502.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program502.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program503.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program503.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program504.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program504.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program505.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program505.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program506.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program506.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program507.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program507.png
--------------------------------------------------------------------------------
/src/main/webapp/images/program508.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/program508.png
--------------------------------------------------------------------------------
/src/main/resources/mysetting.properties:
--------------------------------------------------------------------------------
1 | exam.scheduledTime.default=6000
2 | exam.detail.allowed=false
3 | exam.timeout.autosubmit=true
--------------------------------------------------------------------------------
/src/main/webapp/fonts/materialicons.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/materialicons.woff2
--------------------------------------------------------------------------------
/src/main/webapp/images/blankquestion1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/blankquestion1.jpg
--------------------------------------------------------------------------------
/src/main/webapp/images/importexport2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/importexport2.jpg
--------------------------------------------------------------------------------
/src/main/webapp/images/judgequestion1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/judgequestion1.jpg
--------------------------------------------------------------------------------
/src/main/webapp/images/questiontype2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/questiontype2.jpg
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-solid-900.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-solid-900.eot
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-solid-900.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-solid-900.ttf
--------------------------------------------------------------------------------
/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Bold.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Bold.eot
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Bold.ttf
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Thin.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Thin.eot
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Thin.ttf
--------------------------------------------------------------------------------
/src/main/webapp/images/choicequestion1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/choicequestion1.jpg
--------------------------------------------------------------------------------
/src/main/webapp/images/papergenerator2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/images/papergenerator2.jpg
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-brands-400.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-brands-400.eot
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-brands-400.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-brands-400.ttf
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-brands-400.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-brands-400.woff
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-brands-400.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-brands-400.woff2
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-regular-400.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-regular-400.eot
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-regular-400.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-regular-400.ttf
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-regular-400.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-regular-400.woff
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-solid-900.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-solid-900.woff
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-solid-900.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-solid-900.woff2
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Bold.woff
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Bold.woff2
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Light.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Light.eot
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Light.ttf
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Light.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Light.woff
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Medium.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Medium.eot
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Medium.ttf
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Thin.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Thin.woff
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Thin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Thin.woff2
--------------------------------------------------------------------------------
/src/main/webapp/webfonts/fa-regular-400.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/webfonts/fa-regular-400.woff2
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Light.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Light.woff2
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Medium.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Medium.woff
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Medium.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Medium.woff2
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Regular.eot
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Regular.ttf
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Regular.woff
--------------------------------------------------------------------------------
/src/main/webapp/fonts/roboto/Roboto-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/roboto/Roboto-Regular.woff2
--------------------------------------------------------------------------------
/src/main/webapp/fonts/material-design-icons/Material-Design-Icons.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/material-design-icons/Material-Design-Icons.eot
--------------------------------------------------------------------------------
/src/main/webapp/fonts/material-design-icons/Material-Design-Icons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/material-design-icons/Material-Design-Icons.ttf
--------------------------------------------------------------------------------
/src/main/webapp/fonts/material-design-icons/Material-Design-Icons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/material-design-icons/Material-Design-Icons.woff
--------------------------------------------------------------------------------
/src/main/webapp/fonts/material-design-icons/Material-Design-Icons.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikemelon/java-exam/HEAD/src/main/webapp/fonts/material-design-icons/Material-Design-Icons.woff2
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/common/FileLocation.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.common;
2 |
3 | public interface FileLocation {
4 | //题库中用到的图片文件的存放路径
5 | String QUESTION_BANK_PICTURE_PATH = "d:\\mypic";
6 | }
7 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/common/QuestionType.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.common;
2 | /*
3 | * 题型
4 | */
5 | public enum QuestionType {
6 | CHOICE, BLANK_FILLING, JUDGE //选择题,填空题,判断题,在examquestion表中的questionType字段中分别用0,1,2表示
7 | }
8 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//src/main/java=utf-8
3 | encoding//src/main/resources=utf-8
4 | encoding//src/main/webapp/include/header.jsp=UTF-8
5 | encoding//src/main/webapp/index.jsp=UTF-8
6 | encoding//src/test/java=utf-8
7 | encoding/=utf-8
8 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.common.project.facet.core.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/common/ExamPhase.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.common;
2 |
3 | public enum ExamPhase {
4 | PAPER_INITIALIZED("试卷初始化"), FINAL_SCORED("最终得分");
5 |
6 | private String chineseName;
7 | private ExamPhase(String chineseName){
8 | this.chineseName = chineseName;
9 | }
10 | public String getChineseName(){
11 | return chineseName;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/GradeDao.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao;
2 |
3 | import java.util.List;
4 |
5 | import cn.lynu.lyq.java_exam.entity.Grade;
6 |
7 | public interface GradeDao {
8 |
9 | Grade findById(int id);
10 | List findAll();
11 | List findByName(String name);
12 | void save(Grade g);
13 | void update(Grade g);
14 | void delete(Grade g);
15 |
16 | }
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/test/ExamPhaseTest.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.test;
2 |
3 | import cn.lynu.lyq.java_exam.common.ExamPhase;
4 |
5 | public class ExamPhaseTest {
6 |
7 | public static void main(String[] args) {
8 | System.out.println("["+ExamPhase.FINAL_SCORED.getChineseName()+"]");
9 | System.out.println("["+ExamPhase.PAPER_INITIALIZED.getChineseName()+"]");
10 |
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.compliance=1.8
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
8 | org.eclipse.jdt.core.compiler.source=1.8
9 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/ExamStrategyDao.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao;
2 |
3 | import java.util.List;
4 |
5 | import cn.lynu.lyq.java_exam.entity.Exam;
6 | import cn.lynu.lyq.java_exam.entity.ExamStrategy;
7 |
8 | public interface ExamStrategyDao {
9 |
10 | List findAll();
11 | List findByExam(Exam exam);
12 | ExamStrategy findById(int id);
13 | void save(ExamStrategy e);
14 | void update(ExamStrategy e);
15 | void delete(ExamStrategy e);
16 |
17 | }
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/common/Constants.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.common;
2 |
3 | public class Constants {
4 | //以下常量需与src/main/resources/mysetting.properties中的键名对应,否则将无法对该设置文件进行读写
5 | public static final String DEFAULT_EXAM_SCHEDULED_TIME = "exam.scheduledTime.default"; //默认(创建的)考试的时长 100分钟(即6000秒)
6 | public static final String EXAM_DETAIL_ALLOWED = "exam.detail.allowed"; //在学生试卷列表页面(studentExamList.jsp)中是否允许查看试卷详细
7 | public static final String EXAM_TIMEOUT_AUTOSUBMIT = "exam.timeout.autosubmit"; //考试超时,是否强制自动提交。
8 | }
9 |
--------------------------------------------------------------------------------
/.settings/.jsdtscope:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/StudentDao.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao;
2 |
3 | import java.io.File;
4 | import java.util.List;
5 |
6 | import cn.lynu.lyq.java_exam.entity.Grade;
7 | import cn.lynu.lyq.java_exam.entity.Student;
8 |
9 | public interface StudentDao {
10 | Student findByRegNoAndPassword(String regNo, String password);
11 | List findStudentForSearch(String regNo, String name, Boolean gender, String gradeName);
12 |
13 | Student findById(int id);
14 | List findAll();
15 | List findByGrade(Grade g);
16 |
17 | void save(Student s);
18 | void update(Student s);
19 | void delete(Student s);
20 |
21 | int importFromTxt(File file);
22 |
23 | }
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.common.component:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/websocket/GetHttpSessionConfigurator.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.websocket;
2 |
3 | import javax.servlet.http.HttpSession;
4 | import javax.websocket.HandshakeResponse;
5 | import javax.websocket.server.HandshakeRequest;
6 | import javax.websocket.server.ServerEndpointConfig;
7 | import javax.websocket.server.ServerEndpointConfig.Configurator;
8 |
9 | public class GetHttpSessionConfigurator extends Configurator {
10 | @Override
11 | public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
12 | HttpSession httpSession =(HttpSession)request.getHttpSession();
13 | sec.getUserProperties().put(HttpSession.class.getName(), httpSession);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/BankJudgeQuestion.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import javax.persistence.Entity;
4 |
5 | /*
6 | * 判断题题库
7 | * 答案(该属性在父类里):直接用true或false的字符串表示
8 | */
9 | @Entity
10 | public class BankJudgeQuestion extends BankQuestion {
11 |
12 | public BankJudgeQuestion(){}
13 |
14 | public BankJudgeQuestion(String content,String answer,String knowledgePoint) {
15 | setContent(content);
16 | setAnswer(answer);
17 | setKnowledgePoint(knowledgePoint);
18 | setComposeFlag(1); //默认允许题目参与随机抽题
19 | }
20 |
21 | @Override
22 | public String toString() {
23 | return String.valueOf(getId());
24 | // return "判断题 [题目:" + getContent()
25 | // + ", 答案:" + getAnswer() + "]";
26 | }
27 |
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/Grade.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import javax.persistence.Entity;
4 | import javax.persistence.GeneratedValue;
5 | import javax.persistence.GenerationType;
6 | import javax.persistence.Id;
7 |
8 | @Entity
9 | public class Grade {
10 | @Id
11 | @GeneratedValue(strategy=GenerationType.IDENTITY)
12 | private int id;
13 | private String name;
14 |
15 | public Grade(){}
16 |
17 | public Grade(String name) {
18 | this.name = name;
19 | }
20 |
21 | public int getId() {
22 | return id;
23 | }
24 | public void setId(int id) {
25 | this.id = id;
26 | }
27 | public String getName() {
28 | return name;
29 | }
30 |
31 | public void setName(String name) {
32 | this.name = name;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/webapp/other/判断题import.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应至少以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节或知识点
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示判断题题干描述,可以为多行
5 | ###### 注意,题干的第二行开始开头不能再用字母或数字(因已经被题干的首字符占用)
6 | ######题干结束后的一行,以三个>号开头(">>>")表示答案,用T表示真,F表示假
7 | ######所有题结束后最后一行应至少以6个#号开头("######"),后续不能有空行!
8 | ######
9 | ***异常处理***
10 | 1. 一个异常处理中 finally语句块只能有一个或者可以没有。( )
11 | 嗷嗷嗷嗷第二行
12 | >>>T
13 | ######
14 | ***异常处理***
15 | 2. 运行时异常(RuntimeException) 可以不处理,由虚拟机接管。( )。
16 | >>>T
17 | ######
18 | ***异常处理***
19 | 3. 方法的throws声明异常时,可以声明多种异常。( )
20 | >>>T
21 | ######
22 | ***异常处理***
23 | 4,异常处理中,如果try语句块中有return语句,其对应的finally语句块可能不会执行。( )
24 | >>>F
25 | ######
26 | ***异常处理***
27 | 5. 任何变量在使用前都必须显式初始化。( )
28 | >>>F
29 | ######
--------------------------------------------------------------------------------
/src/main/resources/import/判断题import.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应至少以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节或知识点
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示判断题题干描述,可以为多行
5 | ###### 注意,题干的第二行开始开头不能再用字母或数字(因已经被题干的首字符占用)
6 | ######题干结束后的一行,以三个>号开头(">>>")表示答案,用T表示真,F表示假
7 | ######所有题结束后最后一行应至少以6个#号开头("######"),后续不能有空行!
8 | ######
9 | ***异常处理***
10 | 1. 一个异常处理中 finally语句块只能有一个或者可以没有。( )
11 | 嗷嗷嗷嗷第二行
12 | >>>T
13 | ######
14 | ***异常处理***
15 | 2. 运行时异常(RuntimeException) 可以不处理,由虚拟机接管。( )。
16 | >>>T
17 | ######
18 | ***异常处理***
19 | 3. 方法的throws声明异常时,可以声明多种异常。( )
20 | >>>T
21 | ######
22 | ***异常处理***
23 | 4,异常处理中,如果try语句块中有return语句,其对应的finally语句块可能不会执行。( )
24 | >>>F
25 | ######
26 | ***异常处理***
27 | 5. 任何变量在使用前都必须显式初始化。( )
28 | >>>F
29 | ######
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/test/CustomRenderer.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.test;
2 |
3 | import java.awt.Color;
4 | import java.awt.Paint;
5 |
6 | public class CustomRenderer extends org.jfree.chart.renderer.category.BarRenderer {
7 |
8 | /**
9 | *
10 | */
11 | private static final long serialVersionUID = 784630226449158436L;
12 | private Paint[] colors;
13 | // 初始化柱子颜色
14 | private String[] colorValues = { "#AFD8F8", "#F6BD0F", "#8BBA00", "#FF8E46", "#008E8E", "#D64646" };
15 |
16 | public CustomRenderer() {
17 | colors = new Paint[colorValues.length];
18 | for (int i = 0; i < colorValues.length; i++) {
19 | colors[i] = Color.decode(colorValues[i]);
20 | }
21 | }
22 |
23 | // 每根柱子以初始化的颜色不断轮循
24 | public Paint getItemPaint(int i, int j) {
25 | return colors[j % colors.length];
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/misc/CustomColorBarRenderer.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.misc;
2 |
3 | import java.awt.Color;
4 | import java.awt.Paint;
5 |
6 | import org.jfree.chart.renderer.category.BarRenderer;
7 |
8 | public class CustomColorBarRenderer extends BarRenderer{
9 | private static final long serialVersionUID = 7591667405354466916L;
10 |
11 | private Paint[] colors;
12 | // 初始化柱子颜色
13 | private String[] colorValues = { "#AFD8F8", "#F6BD0F", "#8BBA00", "#FF8E46", "#008E8E", "#D64646" };
14 |
15 | public CustomColorBarRenderer() {
16 | colors = new Paint[colorValues.length];
17 | for (int i = 0; i < colorValues.length; i++) {
18 | colors[i] = Color.decode(colorValues[i]);
19 | }
20 | }
21 |
22 | // 每根柱子以初始化的颜色不断轮循
23 | public Paint getItemPaint(int i, int j) {
24 | return colors[j % colors.length];
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/resources/import/选择题import2.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示选择题题干描述,可以为多行
5 | ######以A. B. C. D. E. ...这些字母开头的行表示选项,每个选项可以为多行,但行之间不能有空行; 每题最多8个选项(A~H)
6 | ###### 注意,每个选项的第二行不能再用字母或数字(因已经被选项、题干占用)
7 | ######选项行结束后的一行,以三个>号开头(">>>")表示答案,多选题答案用逗号隔开,如A,B,C
8 | ######所有题结束后最后一行应以6个#号开头("######"),后续不能有空行!
9 | ######
10 | ***Java异常***
11 | 1,Java中用来抛出异常的关键字是( )
12 | A. try
13 | B. catch
14 | C. throw
15 | D. finally
16 | >>>C
17 | ######
18 | ***Java异常***
19 | 2,下面哪个类是所有异常类的父类( )。
20 | A.Throwable
21 | B.Error
22 | C.Exception
23 | D.AWTError
24 | >>>A
25 | ######
26 | ***Java异常***
27 | 4,对于异常处理中catch子句的排列方式,下列正确的一项是:( )
28 | A. 子类异常在前,父类异常在后
29 | B. 父类异常在前,子类异常在后
30 | C. 只能有子类异常
31 | D. 父类异常与子类异常不能同时出现
32 | >>>A
33 | ######
--------------------------------------------------------------------------------
/src/main/webapp/all.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ taglib uri="/struts-tags" prefix="s" %>
4 |
5 |
6 |
7 |
8 | 测试!
9 |
10 |
11 | ${message}
12 | TODO:
13 | 5,用户注册页面,用户信息查看页面,编辑
14 |
15 | 7,各题型的搜索页面上,点击题目,弹出模态窗口,显示题目详细信息。
16 |
17 | 8,学生进入考试后,按照评分策略初步判分,,,,--》最终判分?
18 |
19 | 9,解决题目中包含图片的问题
20 | 1)能支持导入zip格式的各题型
21 | 2)页面能正常显示各题目中的图
22 |
23 | 10,抽题组卷部分:添加对Exam本身进行编辑action,主要是问题的增减。
24 |
25 | 11,分页显示,可先在题型搜索页面实现(搞定)
26 |
27 | 12,在试题分析中,topN排行,
28 | 1)搜ExamQuestion,查看正确率最高的5个问题,用JFreeChart柱状图。
29 | 2)搜StudentExamScore,查看平均分最高的5个用户,柱状图
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/main/webapp/other/填空题import.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应至少以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节或知识点
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示填空题题干描述,可以为多行
5 | ######题干中用下划线表示填空的位置。
6 |
7 | ###### 注意,题干的第二行开始开头不能再用字母或数字(因已经被题干的首字符占用)
8 | ######题干结束后的一行,以三个>号开头(">>>")表示答案,多个答案用空格分割;
9 |
10 | #######在有可能引起歧义的情况下(例如答案中本身含有逗号),题干可采用第二种形式,
11 | #######即在题干中包含答案,答案用<<<和>>>包围,此时不应有专门的答案行。
12 | ######所有题结束后最后一行应至少以6个#号开头("######"),后续不能有空行!
13 |
14 | ######
15 | ***异常处理***
16 | 1. 对于程序中某个方法中可能出现的受检查异常(Checked Exception),
17 | 要么用try…catch语句捕获并处理它,要么用______________关键字声明抛出该异常。
18 | >>>throws
19 | ######
20 | ***Java语言基础***
21 | 2. 由于Java基本类型中的double或float在计算高精度时会产生损失,
22 | 应选用______________类来进行高精度数学计算。
23 | >>>BigDecimal
24 | ######
25 | ***多线程***
26 | 3, Thread类的______________方法可以设定线程的优先级,优先级的值越_______,表示优先级别越高。
27 | >>>setPriority(),高
28 | ######
--------------------------------------------------------------------------------
/src/main/resources/import/填空题import.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应至少以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节或知识点
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示填空题题干描述,可以为多行
5 | ######题干中用下划线表示填空的位置。
6 |
7 | ###### 注意,题干的第二行开始开头不能再用字母或数字(因已经被题干的首字符占用)
8 | ######题干结束后的一行,以三个>号开头(">>>")表示答案,多个答案用空格分割;
9 |
10 | #######在有可能引起歧义的情况下(例如答案中本身含有逗号),题干可采用第二种形式,
11 | #######即在题干中包含答案,答案用<<<和>>>包围,此时不应有专门的答案行。
12 | ######所有题结束后最后一行应至少以6个#号开头("######"),后续不能有空行!
13 |
14 | ######
15 | ***异常处理***
16 | 1. 对于程序中某个方法中可能出现的受检查异常(Checked Exception),
17 | 要么用try…catch语句捕获并处理它,要么用______________关键字声明抛出该异常。
18 | >>>throws
19 | ######
20 | ***Java语言基础***
21 | 2. 由于Java基本类型中的double或float在计算高精度时会产生损失,
22 | 应选用______________类来进行高精度数学计算。
23 | >>>BigDecimal
24 | ######
25 | ***多线程***
26 | 3, Thread类的______________方法可以设定线程的优先级,优先级的值越_______,表示优先级别越高。
27 | >>>setPriority(),高
28 | ######
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/test/BlankFillingTest1.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.test;
2 |
3 | import java.util.regex.Matcher;
4 | import java.util.regex.Pattern;
5 |
6 | public class BlankFillingTest1 {
7 |
8 | public static void main(String[] args) {
9 | // String str="填空_____号码,好的___,哈哈,____";
10 | // Pattern p=Pattern.compile("[_]{2,}");
11 | // Matcher m = p.matcher(str);
12 | // while(m.find()){
13 | // m.re
14 | // }
15 | // String str2 = str.replaceAll("[_]{2,}", "");
16 | // logger.debug(str2);
17 |
18 | Pattern p = Pattern.compile("cat");
19 | Matcher m = p.matcher("one cat two cats in the yard");
20 | StringBuffer sb = new StringBuffer();
21 | int i=1;
22 | while (m.find()) {
23 | m.appendReplacement(sb, "dog"+i);
24 | i++;
25 | }
26 | m.appendTail(sb);
27 | System.out.println(sb.toString());
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/ExamQuestionDao.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao;
2 |
3 | import java.util.List;
4 |
5 | import cn.lynu.lyq.java_exam.entity.BankBlankFillingQuestion;
6 | import cn.lynu.lyq.java_exam.entity.BankChoiceQuestion;
7 | import cn.lynu.lyq.java_exam.entity.BankJudgeQuestion;
8 | import cn.lynu.lyq.java_exam.entity.Exam;
9 | import cn.lynu.lyq.java_exam.entity.ExamQuestion;
10 |
11 | public interface ExamQuestionDao {
12 | ExamQuestion findById(int id);
13 | List findAll();
14 | List findByExam(Exam e);
15 |
16 | List findByBankChoiceQuestion(BankChoiceQuestion q);
17 | List findByBankBlankFillingQuestion(BankBlankFillingQuestion q);
18 | List findByBankJudgeQuestion(BankJudgeQuestion q);
19 |
20 | void save(ExamQuestion eq);
21 | void update(ExamQuestion eq);
22 | void delete(ExamQuestion eq);
23 |
24 | }
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/utils/QuestionUtils.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.utils;
2 |
3 | public class QuestionUtils {
4 | /**
5 | * 数据库表中,选择题的选项,前面有可能已经有"A.","B."这样的字符串了,该方法检测到有的话就去掉。
6 | * @param choiceOption
7 | * @return
8 | */
9 | public static String deleteOptionLetter(String choiceOption){
10 | if(choiceOption!=null && choiceOption.length()>1){
11 | choiceOption = choiceOption.trim();
12 | char optionLetter = choiceOption.charAt(0);
13 | char dotChar = choiceOption.charAt(1);
14 | if("ABCDEFGH".contains(String.valueOf(optionLetter)) )
15 | choiceOption = choiceOption.substring(1);
16 | if(dotChar=='.' || dotChar=='.')
17 | choiceOption = choiceOption.substring(1);
18 | return choiceOption.trim();
19 | }else
20 | return "";
21 | }
22 |
23 | public static void main(String[] args) {
24 | // TODO Auto-generated method stub
25 |
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/ExamDao.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao;
2 |
3 | import java.util.List;
4 |
5 | import cn.lynu.lyq.java_exam.entity.BankBlankFillingQuestion;
6 | import cn.lynu.lyq.java_exam.entity.BankChoiceQuestion;
7 | import cn.lynu.lyq.java_exam.entity.BankJudgeQuestion;
8 | import cn.lynu.lyq.java_exam.entity.Exam;
9 |
10 | public interface ExamDao {
11 |
12 | List findAllFixedExam();//查找固定组卷的考试
13 | List findAllDistinctExamName();//查找所有考试名(随机试卷算1个)
14 | List findByStudentNameAndExamNameAlike(String studentName, String examName);
15 |
16 | Exam findById(int id);
17 | void save(Exam e);
18 | void update(Exam e);
19 | void delete(Exam e);
20 | void composeExamRandom(Exam exam, int choiceNum,int blankFillingNum, int judgeNum);
21 |
22 | void examCreateWithQuestions(Exam exam, List choiceList,
23 | List blankList,List judgeList);
24 |
25 | }
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/StudentExamScoreDao.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao;
2 |
3 | import java.util.List;
4 |
5 | import cn.lynu.lyq.java_exam.entity.Exam;
6 | import cn.lynu.lyq.java_exam.entity.Student;
7 | import cn.lynu.lyq.java_exam.entity.StudentExamScore;
8 |
9 | public interface StudentExamScoreDao {
10 |
11 | List findByStudent(Student s);
12 | List findByExamPhase(String examPhase);
13 | List findByClassIdAndExamNameAndExamPhase(String classId, String examName, String examPhase);
14 | List findByStudentAndExamPhase(Student s, String examPhase);
15 | List findByStudentAndExam(Student s, Exam e);
16 | List getAbsentStudentsForExamName(String classId, String examName);
17 |
18 | StudentExamScore findById(int id);
19 | List findAll();
20 | void save(StudentExamScore ses);
21 | void update(StudentExamScore ses);
22 | void delete(StudentExamScore ses);
23 | }
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/QuestionStatsAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.context.annotation.Scope;
6 | import org.springframework.stereotype.Component;
7 |
8 | import com.opensymphony.xwork2.ActionContext;
9 | import com.opensymphony.xwork2.ActionSupport;
10 |
11 | @Component("questionStats")
12 | @Scope("prototype")
13 | public class QuestionStatsAction extends ActionSupport {
14 | private static final long serialVersionUID = -6315314962483922015L;
15 | private final static Logger logger = LoggerFactory.getLogger(QuestionStatsAction.class);
16 |
17 | @Override
18 | public String execute() throws Exception {
19 | ActionContext ctx =ActionContext.getContext();
20 | logger.info("问题统计");
21 | if(ctx.getSession().containsKey("USER_INFO")){
22 | return SUCCESS;
23 | }else{
24 | this.addActionError("您还没有登录,请登录后再点击进入");
25 | return ERROR;
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/test/BubbleSort.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.test;
2 |
3 | import java.util.Arrays;
4 |
5 | public class BubbleSort {
6 |
7 | public static void main(String[] args) {
8 | int[] array ={ 4, 8, 3, 2, 9, 10, 6, 2, 8, 7, 1};
9 | int[] index= new int[array.length];
10 | for(int i=0; i
3 |
4 |
5 |
6 |
7 |
8 | Insert title here
9 |
10 |
11 |
12 |
21 |
22 |
30 |
31 |
--------------------------------------------------------------------------------
/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/main/resources/import/选择题import.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示选择题题干描述,可以为多行
5 | ######以A. B. C. D. E. ...这些字母开头的行表示选项,每个选项可以为多行,但行之间不能有空行; 每题最多8个选项(A~H)
6 | ###### 注意,每个选项的第二行不能再用字母或数字(因已经被选项、题干占用)
7 | ######选项行结束后的一行,以三个>号开头(">>>")表示答案,多选题答案用逗号隔开,如A,B,C
8 | ######所有题结束后最后一行应以6个#号开头("######"),后续不能有空行!
9 | ######
10 | ***Java集合类***
11 | 1,下列哪些方法是ArrayList和LinkedList集合中都定义的(多选)( )
12 | A. add(Object o)
13 | 阿飞
14 | B. removeFirst()
15 | C. remove(Object o)
16 | D. add(int index,Object o)
17 | >>>A,C,D
18 | ######
19 | ***Java集合类***
20 | 2,不是迭代器接口(Iterator)所定义的方法是( )。
21 | A.hasNext()
22 | B.next()
23 | C.remove()
24 | D.nextElement()
25 | >>>D
26 | ######
27 | ***Java集合类***
28 | 3,下面那个方法不是接口Collection中已声明的方法( )
29 | A.添加元素的add(Object obj) 方法
30 | B.删除元素的remove(Object obj)方法
31 | C.得到元素个数的length()方法
32 | D.返回迭代器的iterator()方法,迭代器用于元素遍历
33 | >>>C
34 | ######
35 | ***Java集合类***
36 | 4,分析如下程序运行结果:
37 | [[[program001.jpg]]]
38 | A. [Hello, World, Hello, Learn]
39 | B. [Learn]
40 | 多少岁
41 | C. [Hello, Learn]
42 | D. [World, Hello, Learn]
43 | >>>C
44 | ######
--------------------------------------------------------------------------------
/src/main/webapp/other/选择题import.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示选择题题干描述,可以为多行
5 | ######以A. B. C. D. E. ...这些字母开头的行表示选项,每个选项可以为多行,但行之间不能有空行; 每题最多8个选项(A~H)
6 | ###### 注意,每个选项的第二行不能再用字母或数字(因已经被选项、题干占用)
7 | ######选项行结束后的一行,以三个>号开头(">>>")表示答案,多选题答案用逗号隔开,如A,B,C
8 | ######所有题结束后最后一行应以6个#号开头("######"),后续不能有空行!
9 | ######
10 | ***Java集合类***
11 | 1,下列哪些方法是ArrayList和LinkedList集合中都定义的(多选)( )
12 | A. add(Object o)
13 | 阿飞
14 | B. removeFirst()
15 | C. remove(Object o)
16 | D. add(int index,Object o)
17 | >>>A,C,D
18 | ######
19 | ***Java集合类***
20 | 2,不是迭代器接口(Iterator)所定义的方法是( )。
21 | A.hasNext()
22 | B.next()
23 | C.remove()
24 | D.nextElement()
25 | >>>D
26 | ######
27 | ***Java集合类***
28 | 3,下面那个方法不是接口Collection中已声明的方法( )
29 | A.添加元素的add(Object obj) 方法
30 | B.删除元素的remove(Object obj)方法
31 | C.得到元素个数的length()方法
32 | D.返回迭代器的iterator()方法,迭代器用于元素遍历
33 | >>>C
34 | ######
35 | ***Java集合类***
36 | 4,分析如下程序运行结果:
37 | [[[program001.jpg]]]
38 | A. [Hello, World, Hello, Learn]
39 | B. [Learn]
40 | 多少岁
41 | C. [Hello, Learn]
42 | D. [World, Hello, Learn]
43 | >>>C
44 | ######
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/ExamQuestionAnswerDao.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao;
2 |
3 | import java.util.List;
4 |
5 | import cn.lynu.lyq.java_exam.entity.Exam;
6 | import cn.lynu.lyq.java_exam.entity.ExamQuestion;
7 | import cn.lynu.lyq.java_exam.entity.ExamQuestionAnswer;
8 | import cn.lynu.lyq.java_exam.entity.Student;
9 |
10 | public interface ExamQuestionAnswerDao {
11 |
12 | ExamQuestionAnswer findById(int id);
13 | List findAll();
14 | // List findForExam(Exam exam);
15 |
16 | //针对对每种题库中的题型搜索
17 | // List findForBankChoiceQuestion(BankChoiceQuestion q);
18 | // List findForBankBlankFillingQuestion(BankBlankFillingQuestion q);
19 | // List findForBankJudgeQuestion(BankJudgeQuestion q);
20 |
21 | List findByExamQuestion(ExamQuestion eq);
22 | ExamQuestionAnswer findByStudentAndExamQuestion(Student student, ExamQuestion examQuestion);
23 |
24 | //针对某个学生的对某次考试的搜索,相当于该学生的一份答卷
25 | List findByStudentAndExam(Exam exam,Student student);
26 |
27 | void save(ExamQuestionAnswer eqa);
28 | void update(ExamQuestionAnswer eqa);
29 | void delete(ExamQuestionAnswer eqa);
30 |
31 | }
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/SimpleTestAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.context.annotation.Scope;
6 | import org.springframework.stereotype.Component;
7 |
8 | import com.opensymphony.xwork2.ActionSupport;
9 |
10 | @Component("simpleTest")
11 | @Scope("prototype")
12 | public class SimpleTestAction extends ActionSupport {
13 |
14 | private static final long serialVersionUID = 4075728253429075870L;
15 | private final static Logger logger = LoggerFactory.getLogger(SimpleTestAction.class);
16 | private String answerSearch="aaaa";
17 | private String answerSearch2;
18 | public String getAnswerSearch() {
19 | return answerSearch;
20 | }
21 | public void setAnswerSearch(String answerSearch) {
22 | this.answerSearch = answerSearch;
23 | }
24 | public String getAnswerSearch2() {
25 | return answerSearch2;
26 | }
27 | public void setAnswerSearch2(String answerSearch2) {
28 | this.answerSearch2 = answerSearch2;
29 | }
30 | @Override
31 | public String execute() throws Exception {
32 | logger.debug(">>>>>>>>>>>>>answerSearch========"+answerSearch);
33 | logger.debug(">>>>>>>>>>>>>answerSearch2========"+answerSearch2);
34 | return SUCCESS;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/webapp/include/footer.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 |
28 |
--------------------------------------------------------------------------------
/src/main/webapp/css/material_icons.css:
--------------------------------------------------------------------------------
1 | /* fallback */
2 | @font-face {
3 | font-family: 'Material Icons';
4 | font-style: normal;
5 | font-weight: 400;
6 | /*src: url('../fonts/material-design-icons/Material-Design-Icons.eot');*/
7 | src: local('Material Icons'), local('MaterialIcons-Regular'),
8 | /*url('../fonts/material-design-icons/Material-Design-Icons.eot?#iefix') format('embedded-opentype'),
9 | url('../fonts/material-design-icons/Material-Design-Icons.woff') format('woff'),
10 | url('../fonts/material-design-icons/Material-Design-Icons.ttf') format('truetype'),
11 | url('../fonts/material-design-icons/Material-Design-Icons.svg#MaterialIcons-Regular') format('svg'),
12 | url('../fonts/material-design-icons/Material-Design-Icons.woff2') format('woff2');*/
13 | url('../fonts/materialicons.woff2') format('woff2');
14 | }
15 |
16 | .material-icons {
17 | font-family: 'Material Icons';
18 | font-weight: normal;
19 | font-style: normal;
20 | font-size: 24px;
21 | line-height: 1;
22 | letter-spacing: normal;
23 | text-transform: none;
24 | display: inline-block;
25 | white-space: nowrap;
26 | word-wrap: normal;
27 | direction: ltr;
28 | -webkit-font-feature-settings: 'liga';
29 | -webkit-font-smoothing: antialiased;
30 | }
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | java-exam
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.jsdt.core.javascriptValidator
10 |
11 |
12 |
13 |
14 | org.eclipse.jdt.core.javabuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.wst.common.project.facet.core.builder
20 |
21 |
22 |
23 |
24 | org.eclipse.wst.validation.validationbuilder
25 |
26 |
27 |
28 |
29 | org.eclipse.m2e.core.maven2Builder
30 |
31 |
32 |
33 |
34 |
35 | org.eclipse.jem.workbench.JavaEMFNature
36 | org.eclipse.wst.common.modulecore.ModuleCoreNature
37 | org.eclipse.jdt.core.javanature
38 | org.eclipse.m2e.core.maven2Nature
39 | org.eclipse.wst.common.project.facet.core.nature
40 | org.eclipse.wst.jsdt.core.jsNature
41 |
42 |
43 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # java-exam
2 | Java实现的包含题库编辑、抽题组卷、试题分析、在线考试等模块的Web考试系统。
3 |
4 | 已经实现的主要功能有:
5 | - 在线考试(包含限定时间设置),支持选择题、填空题、判断题三种题型,自动判分
6 | - 选择题、填空题、判断题及用户信息的文本文件数据的Web导入
7 | - 用户注册、登录、修改密码、基本信息管理
8 | - 按照一定给分策略进行抽题和组卷,支持“固定组卷” 和“随机组卷”两种方式
9 | - 按照内容、知识点、答案等搜索题库,题目及分数的统计
10 | - 章节知识点的分层和树状展示
11 | - 管理广播消息的推送、系统设置的修改
12 |
13 | 目前项目基于以下平台(框架、库):
14 | - JDK 1.8
15 | - Tomcat 8.0 (with WebSocket)
16 | - Hibernate 5.1
17 | - Struts 2.5
18 | - Spring 4.3
19 | - JFreeChart 1.0.19
20 | - Maven
21 | - Materialize v0.97.6 (CSS)
22 | - Font Awesome 5.1.1
23 |
24 | 项目在Eclipse JEE下开发。
25 |
26 | 数据库设计:
27 | - (MySQL Workbench导出)
28 | 
29 |
30 | - (简版)
31 | 
32 |
33 | 部分功能截图如下:
34 | - (未登录)
35 | 
36 |
37 | - (教师用户登陆)
38 | 
39 |
40 | - (知识点展示)
41 | 
42 |
43 | - (答题扇形图)
44 | 
45 |
46 | - (成绩柱状图)
47 | 
48 |
49 | - (固定组卷)
50 | 
51 |
52 | - (随机组卷)
53 | 
54 |
55 | - (导入题库及学生信息)
56 | 
57 |
58 | - (未考和已考列表)
59 | 
60 |
61 | - (在线考试中)
62 | 
63 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Struts2 Exam App
4 |
5 | main.html
6 | main.jsp
7 |
8 |
9 | 120
10 |
11 |
12 | contextConfigLocation
13 | classpath:applicationContext.xml
14 |
15 |
16 | org.springframework.web.context.ContextLoaderListener
17 |
18 |
19 | struts2
20 |
21 | org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
22 |
23 |
24 | actionPackages
25 | cn.lynu.lyq.java_exam.actions
26 |
27 |
28 |
29 | struts2
30 | /*
31 |
32 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/JudgeDetailAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.context.annotation.Scope;
8 | import org.springframework.stereotype.Component;
9 |
10 | import com.opensymphony.xwork2.ActionContext;
11 | import com.opensymphony.xwork2.ActionSupport;
12 |
13 | import cn.lynu.lyq.java_exam.dao.BankQuestionDao;
14 | import cn.lynu.lyq.java_exam.entity.BankJudgeQuestion;
15 |
16 | @Component("judgeDetail")
17 | @Scope("prototype")
18 | public class JudgeDetailAction extends ActionSupport {
19 | private static final long serialVersionUID = 1320414130188344435L;
20 | private final static Logger logger = LoggerFactory.getLogger(JudgeDetailAction.class);
21 |
22 | private BankJudgeQuestion question;
23 | @Resource
24 | private BankQuestionDao bankQuestionDao;
25 |
26 | public BankJudgeQuestion getQuestion() {
27 | return question;
28 | }
29 | public void setQuestion(BankJudgeQuestion question) {
30 | this.question = question;
31 | }
32 |
33 | @Override
34 | public String execute() throws Exception {
35 | ActionContext ctx = ActionContext.getContext();
36 | logger.info("根据id查询判断题详细");
37 | String qid = ctx.getParameters().get("qid").getValue();
38 | question = bankQuestionDao.findJudgeById(Integer.parseInt(qid.trim()));
39 |
40 | return SUCCESS;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/webapp/other/学生import.txt:
--------------------------------------------------------------------------------
1 | #请使用UTF-8编码,推荐用Notepad++转换
2 | #前面为#号的是注释行,会被忽略
3 | #最好不要有空行,一般情况下空行(或只包含空格的行)会被忽略
4 | #下面是标题行,请注意只能使用“学号,姓名,性别,班级,密码”这些字段名,其中学号和姓名不可省略
5 | 学号,姓名,性别,班级
6 | 121144001 万圆圆 女 2012级电子商务班
7 | 121144003 黄鑫 女 2012级电子商务班
8 | 121144005 曹田田 女 2012级电子商务班
9 | 121144009 李彩婷 女 2012级电子商务班
10 | 121144011 许玉洁 女 2012级电子商务班
11 | 121144013 张聪 女 2012级电子商务班
12 | 121144015 姚慧娟 女 2012级电子商务班
13 | 121144019 陈妍 女 2012级电子商务班
14 | 121144021 刘亚男 女 2012级电子商务班
15 | 121144023 马兰 女 2012级电子商务班
16 | # 121144025 邵瑞瑞 女 2012级电子商务班
17 | 121144027 席玥 女 2012级电子商务班
18 | 121144029 袁肖艳 女 2012级电子商务班
19 | 121144031 马红革 女 2012级电子商务班
20 | 121144033 吴艳云 女 2012级电子商务班
21 | 121144035 王静 女 2012级电子商务班
22 | 121144037 尚银 女 2012级电子商务班
23 | 121144039 牛冬月 女 2012级电子商务班
24 |
25 | 121144041 李丹 女 2012级电子商务班
26 | 121144043 张秋菊 女 2012级电子商务班
27 | 121144045 翟娟 女 2012级电子商务班
28 | 121144047 秦玉凤 女 2012级电子商务班
29 | 121144049 王灿 女 2012级电子商务班
30 | 121144051 封赟婷 女 2012级电子商务班
31 | 121144053 刘华琰 女 2012级电子商务班
32 | 121144055 徐光 女 2012级电子商务班
33 | 121144057 王娜 女 2012级电子商务班
34 | 121144061 周志康 男 2012级电子商务班
35 | 121144063 姚玉龙 男 2012级电子商务班
36 | 121144065 蒋守勤 男 2012级电子商务班
37 | 121144069 陈夏 男 2012级电子商务班
38 | 121144071 陈亚飞 男 2012级电子商务班
39 | 121144073 张志伟 男 2012级电子商务班
40 | 121144075 钟惠平 女 2012级电子商务班
41 | 121144077 杨芳 女 2012级电子商务班
42 | 121144079 尹君 女 2012级电子商务班
43 | 121144081 赵玉梅 女 2012级电子商务班
44 | 121144083 韦家尚 男 2012级电子商务班
45 | 121144085 李娅 女 2012级电子商务班
46 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/ExamListShowAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import java.util.List;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.context.annotation.Scope;
10 | import org.springframework.stereotype.Component;
11 |
12 | import com.opensymphony.xwork2.ActionContext;
13 | import com.opensymphony.xwork2.ActionSupport;
14 |
15 | import cn.lynu.lyq.java_exam.dao.ExamDao;
16 | import cn.lynu.lyq.java_exam.entity.Exam;
17 |
18 | @Component("examListShow")
19 | @Scope("prototype")
20 | public class ExamListShowAction extends ActionSupport {
21 |
22 | private static final long serialVersionUID = 4675761085855839420L;
23 | private final static Logger logger = LoggerFactory.getLogger(ExamListShowAction.class);
24 | @Resource
25 | private ExamDao examDao;
26 |
27 | private List examList;
28 |
29 | public List getExamList() {
30 | return examList;
31 | }
32 |
33 | public void setExamList(List examList) {
34 | this.examList = examList;
35 | }
36 |
37 | @Override
38 | public String execute() throws Exception {
39 | ActionContext ctx =ActionContext.getContext();
40 | if(ctx.getSession().containsKey("USER_INFO")){
41 | logger.info("显示所有固定组卷考试");
42 | examList = examDao.findAllFixedExam();
43 | return SUCCESS;
44 | }else{
45 | this.addActionError("您还没有登录,请登录后再点击进入");
46 | return ERROR;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/BlankFillingDetailAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.context.annotation.Scope;
8 | import org.springframework.stereotype.Component;
9 |
10 | import com.opensymphony.xwork2.ActionContext;
11 | import com.opensymphony.xwork2.ActionSupport;
12 |
13 | import cn.lynu.lyq.java_exam.dao.BankQuestionDao;
14 | import cn.lynu.lyq.java_exam.entity.BankBlankFillingQuestion;
15 |
16 | @Component("blankFillingDetail")
17 | @Scope("prototype")
18 | public class BlankFillingDetailAction extends ActionSupport {
19 |
20 | private static final long serialVersionUID = -3038382114712565555L;
21 | private final static Logger logger = LoggerFactory.getLogger(BlankFillingDetailAction.class);
22 |
23 | private BankBlankFillingQuestion question;
24 | @Resource
25 | private BankQuestionDao bankQuestionDao;
26 |
27 | public BankBlankFillingQuestion getQuestion() {
28 | return question;
29 | }
30 | public void setQuestion(BankBlankFillingQuestion question) {
31 | this.question = question;
32 | }
33 |
34 | @Override
35 | public String execute() throws Exception {
36 | ActionContext ctx = ActionContext.getContext();
37 | String qid = ctx.getParameters().get("qid").getValue();
38 | logger.info("根据id查找填空题详细信息");
39 | question = bankQuestionDao.findBlankFillingById(Integer.parseInt(qid.trim()));
40 |
41 | return SUCCESS;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/resources/import/学生import.txt:
--------------------------------------------------------------------------------
1 |
2 | #请使用UTF-8无BOM格式编码,推荐用Notepad++编辑和转换
3 | #如果某行的第一个字符为#号的表示注释行,会被忽略
4 | #最好不要有空行,一般情况下空行(或只包含空格的行)会被忽略
5 | #下面是标题行,请注意只能使用“学号,姓名,性别,班级,密码”这些字段名,用英文半角标点逗号,或空格分隔(不要用中文标点)
6 | #,其中学号和姓名不可省略
7 | 学号,姓名,性别,班级
8 | 121144001 万圆圆 女 2012级电子商务班
9 | 121144003 黄鑫 女 2012级电子商务班
10 | 121144005 曹田田 女 2012级电子商务班
11 | 121144009 李彩婷 女 2012级电子商务班
12 | 121144011 许玉洁 女 2012级电子商务班
13 | 121144013 张聪 女 2012级电子商务班
14 | 121144015 姚慧娟 女 2012级电子商务班
15 | 121144019 陈妍 女 2012级电子商务班
16 | 121144021 刘亚男 女 2012级电子商务班
17 | 121144023 马兰 女 2012级电子商务班
18 | # 121144025 邵瑞瑞 女 2012级电子商务班
19 | 121144027 席玥 女 2012级电子商务班1
20 | 121144029 袁肖艳 女 2012级电子商务班
21 | 121144031 马红革 女 2012级电子商务班
22 | 121144033 吴艳云 女 2012级电子商务班
23 | 121144035 王静 女 2012级电子商务班
24 | 121144037 尚银 女 2012级电子商务班
25 | 121144039 牛冬月 女 2012级电子商务班
26 |
27 | 121144041 李丹 女 2012级电子商务班
28 | 121144043 张秋菊 女 2012级电子商务班
29 | 121144045 翟娟 女 2012级电子商务班
30 | 121144047 秦玉凤 女 2012级电子商务班
31 | 121144049 王灿 女 2012级电子商务班
32 | 121144051 封赟婷 女 2012级电子商务班
33 | 121144053 刘华琰 女 2012级电子商务班
34 | 121144055 徐光 女 2012级电子商务班
35 | 121144057 王娜 女 2012级电子商务班
36 | 121144061 周志康 男 2012级电子商务班
37 | 121144063 姚玉龙 男 2012级电子商务班
38 | 121144065 蒋守勤 男 2012级电子商务班
39 | 121144069 陈夏 男 2012级电子商务班
40 | 121144071 陈亚飞 男 2012级电子商务班
41 | 121144073 张志伟 男 2012级电子商务班
42 | 121144075 钟惠平 女 2012级电子商务班
43 | 121144077 杨芳 女 2012级电子商务班
44 | 121144079 尹君 女 2012级电子商务班
45 | 121144081 赵玉梅 女 2012级电子商务班
46 | 121144083 韦家尚 男 2012级电子商务班
47 | 121144085 李娅 女 2012级电子商务班
48 |
--------------------------------------------------------------------------------
/src/main/webapp/css/jquery.jOrgChart.lyq.css:
--------------------------------------------------------------------------------
1 | /* Basic styling */
2 | /* Draw the lines */
3 | .jOrgChart .oc-line {
4 | height : 20px;
5 | width : 4px;
6 | }
7 |
8 | .jOrgChart .oc-down {
9 | background-color : black;
10 | margin : 0px auto;
11 | }
12 |
13 | .jOrgChart .oc-top {
14 | border-top : 3px solid black;
15 | }
16 |
17 | .jOrgChart .oc-left {
18 | border-right : 2px solid black;
19 | }
20 |
21 | .jOrgChart .oc-right {
22 | border-left : 2px solid black;
23 | }
24 |
25 | /* lyq add to override materialize css */
26 | .jOrgChart *, .jOrgChart *:before, .jOrgChart *:after {
27 | box-sizing: content-box;
28 | }
29 | /* lyq add to override materialize css */
30 | .jOrgChart table{
31 | border-collapse: separate;
32 | width: auto;
33 | font-size: inherit;
34 | line-height:normal;
35 | }
36 |
37 | /* node cell */
38 | .jOrgChart td {
39 | text-align : center;
40 | vertical-align : top;
41 | padding : 0;
42 | border-radius : 0;
43 | }
44 |
45 | /* The node */
46 | .jOrgChart .node {
47 | background-color : #35363B;
48 | display : inline-block;
49 | width : 96px;
50 | height : 60px;
51 | z-index : 10;
52 | margin : 0 2px;
53 | /* lyq add default node style */
54 | font-size: 14px;
55 | line-height: 30px;
56 | background-color: #35363B;
57 | border-radius: 8px;
58 | padding: 5px;
59 | border: 2px solid #f00;
60 | color: #ffff11;
61 | }
62 |
63 | /* jQuery drag 'n drop */
64 |
65 | .drag-active {
66 | border-style : dotted !important;
67 | }
68 |
69 | .drop-hover {
70 | border-style : solid !important;
71 | border-color : #E05E00 !important;
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/UpdateStrategyNameAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.context.annotation.Scope;
8 | import org.springframework.stereotype.Component;
9 |
10 | import com.opensymphony.xwork2.ActionSupport;
11 |
12 | import cn.lynu.lyq.java_exam.dao.ExamStrategyDao;
13 | import cn.lynu.lyq.java_exam.entity.ExamStrategy;
14 |
15 | @Component("updateStrategyName")
16 | @Scope("prototype")
17 | public class UpdateStrategyNameAction extends ActionSupport{
18 | private static final long serialVersionUID = 3877971759903674637L;
19 | private final static Logger logger = LoggerFactory.getLogger(UpdateStrategyNameAction.class);
20 | @Resource
21 | private ExamStrategyDao examStrategyDao;
22 | private String strategyName;
23 | private int strategyId;
24 | private ExamStrategy updatedStrategy;
25 |
26 | public String getStrategyName() {
27 | return strategyName;
28 | }
29 | public void setStrategyName(String strategyName) {
30 | this.strategyName = strategyName;
31 | }
32 | public int getStrategyId() {
33 | return strategyId;
34 | }
35 | public void setStrategyId(int strategyId) {
36 | this.strategyId = strategyId;
37 | }
38 | public ExamStrategy getUpdatedStrategy() {
39 | return updatedStrategy;
40 | }
41 | public void setUpdatedStrategy(ExamStrategy updatedStrategy) {
42 | this.updatedStrategy = updatedStrategy;
43 | }
44 | @Override
45 | public String execute(){
46 | logger.info("更新考试策略名称");
47 | updatedStrategy = examStrategyDao.findById(strategyId);
48 | updatedStrategy.setName(strategyName);
49 | examStrategyDao.update(updatedStrategy);
50 | return SUCCESS;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/Exam.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import java.util.Date;
4 |
5 | import javax.persistence.Entity;
6 | import javax.persistence.GeneratedValue;
7 | import javax.persistence.GenerationType;
8 | import javax.persistence.Id;
9 |
10 | @Entity
11 | public class Exam {
12 | @Id
13 | @GeneratedValue(strategy=GenerationType.IDENTITY)
14 | private int id;
15 | private int type;//0-->固定选择组卷, 1-->随机抽题组卷
16 | private String name;
17 | private String detail;
18 | private Date examDate;
19 | private Date createDate;
20 | private int scheduledTime;//规定考试用时(单位:秒)
21 |
22 | public Exam(){}
23 | public Exam(String name, String detail, int type){
24 | this.name = name;
25 | this.detail = detail;
26 | this.type = type;
27 | }
28 | public int getId() {
29 | return id;
30 | }
31 | public void setId(int id) {
32 | this.id = id;
33 | }
34 | public int getType() {
35 | return type;
36 | }
37 | public void setType(int type) {
38 | this.type = type;
39 | }
40 | public String getName() {
41 | return name;
42 | }
43 | public void setName(String name) {
44 | this.name = name;
45 | }
46 | public String getDetail() {
47 | return detail;
48 | }
49 | public void setDetail(String detail) {
50 | this.detail = detail;
51 | }
52 | public Date getExamDate() {
53 | return examDate;
54 | }
55 | public void setExamDate(Date examDate) {
56 | this.examDate = examDate;
57 | }
58 | public Date getCreateDate() {
59 | return createDate;
60 | }
61 | public void setCreateDate(Date createDate) {
62 | this.createDate = createDate;
63 | }
64 | public int getScheduledTime() {
65 | return scheduledTime;
66 | }
67 | public void setScheduledTime(int scheduledTime) {
68 | this.scheduledTime = scheduledTime;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/test/JFreeChartTest1.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.test;
2 |
3 | import java.awt.Font;
4 | import java.io.File;
5 | import java.io.IOException;
6 |
7 | import org.jfree.chart.ChartFactory;
8 | import org.jfree.chart.ChartUtilities;
9 | import org.jfree.chart.JFreeChart;
10 | import org.jfree.chart.StandardChartTheme;
11 | import org.jfree.chart.plot.CategoryPlot;
12 | import org.jfree.chart.plot.PlotOrientation;
13 | import org.jfree.data.category.CategoryDataset;
14 | import org.jfree.data.general.DatasetUtilities;
15 |
16 | public class JFreeChartTest1 {
17 |
18 | public static void main(String[] args) throws IOException {
19 | double[][] data = new double[][] { { 90 , 80 , 77 , 85 } };
20 | String[] rowKeys = {""};
21 | String[] columnKeys = { "张三", "李四", "王二", "马六" };
22 | CategoryDataset dataset = DatasetUtilities.createCategoryDataset(rowKeys, columnKeys, data);
23 |
24 | // 创建主题样式
25 | StandardChartTheme standardChartTheme = new StandardChartTheme("CN");
26 | // 设置标题字体
27 | standardChartTheme.setExtraLargeFont(new Font("SimHei", Font.BOLD, 20));
28 | // 设置图例的字体
29 | standardChartTheme.setRegularFont(new Font("Microsoft YaHei", Font.PLAIN, 15));
30 | // 设置轴向的字体
31 | standardChartTheme.setLargeFont(new Font("Microsoft YaHei", Font.PLAIN, 15));
32 | // 应用主题样式
33 | ChartFactory.setChartTheme(standardChartTheme);
34 |
35 | JFreeChart chart = ChartFactory.createBarChart3D("成绩分布图", "姓名", "成绩", dataset, PlotOrientation.VERTICAL, true,
36 | false, false);
37 | // String filename = ServletUtilities.saveChartAsPNG(chart, 450, 300,
38 | // null, session);
39 | CategoryPlot plot = chart.getCategoryPlot();// 获得图表区域对象
40 | plot.setRenderer(new CustomRenderer());
41 | ChartUtilities.saveChartAsPNG(new File("d:\\test1.png"), chart, 1000, 600);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/filters/JspFilter.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.filters;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.DispatcherType;
6 | import javax.servlet.Filter;
7 | import javax.servlet.FilterChain;
8 | import javax.servlet.FilterConfig;
9 | import javax.servlet.ServletException;
10 | import javax.servlet.ServletRequest;
11 | import javax.servlet.ServletResponse;
12 | import javax.servlet.annotation.WebFilter;
13 | import javax.servlet.http.HttpServletRequest;
14 |
15 | @WebFilter(dispatcherTypes = {DispatcherType.REQUEST }
16 | , urlPatterns = { "*.jsp" })
17 | /**
18 | * 禁止在地址栏中(或重定向)直接访问jsp
19 | * @author Administrator
20 | *
21 | */
22 | public class JspFilter implements Filter {
23 |
24 | @Override
25 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
26 | throws IOException, ServletException {
27 | HttpServletRequest httpServletRequest = (HttpServletRequest) request;
28 | String url = httpServletRequest.getRequestURI();
29 | if ( url != null && url.endsWith(".jsp")
30 | && url.endsWith("main.jsp")==false
31 | && url.endsWith("importData.jsp")==false
32 | && url.endsWith("questionByKnowledge.jsp")==false
33 | && url.endsWith("questionTypes.jsp")==false
34 | && url.endsWith("examComposeTypes.jsp")==false
35 | && url.endsWith("statsTypes.jsp")==false
36 | && url.endsWith("test.jsp")==false //测试用
37 | && url.endsWith("userChangePassword.jsp")==false) { // 这里可以排除掉一些特殊的允许直接地址栏(或重定向)访问的jsp
38 | httpServletRequest.getRequestDispatcher("/main.jsp").forward(request, response);
39 | return;
40 | }
41 | chain.doFilter(request, response);
42 | }
43 |
44 | @Override
45 | public void init(FilterConfig fConfig) throws ServletException {
46 | }
47 |
48 | @Override
49 | public void destroy() {
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/BankQuestionDao.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao;
2 |
3 | import java.io.File;
4 | import java.util.List;
5 |
6 | import cn.lynu.lyq.java_exam.entity.BankBlankFillingQuestion;
7 | import cn.lynu.lyq.java_exam.entity.BankChoiceQuestion;
8 | import cn.lynu.lyq.java_exam.entity.BankJudgeQuestion;
9 | import cn.lynu.lyq.java_exam.entity.BankQuestion;
10 |
11 | public interface BankQuestionDao {
12 |
13 | List findAll();
14 |
15 | int countAllChoice();
16 | int countAllBlankFilling();
17 | int countAllJudge();
18 |
19 | List findAllChoice();
20 | List findAllBlankFilling();
21 | List findAllJudge();
22 |
23 | //根据组卷标志(目前用于随机抽题)查询
24 | List findChoiceWithComposeFlag(int composeFlag);
25 | List findBlankFillingWithComposeFlag(int composeFlag);
26 | List findJudgeWithComposeFlag(int composeFlag);
27 |
28 | //分页查询
29 | List findAllChoiceWithPage(int pageIndex, int pageSize);
30 | List findAllBlankFillingWithPage(int pageIndex, int pageSize);
31 | List findAllJudgeWithPage(int pageIndex, int pageSize);
32 |
33 | List findChoiceForSearch(String content,String choice,String answer,String knowledge);
34 | List findBlankForSearch(String content,String answer,String knowledge);
35 | List findJudgeForSearch(String content,String answer,String knowledge);
36 |
37 | BankChoiceQuestion findChoiceById(int id);
38 | BankBlankFillingQuestion findBlankFillingById(int id);
39 | BankJudgeQuestion findJudgeById(int id);
40 |
41 | void save(BankQuestion bq);
42 | void update(BankQuestion bq);
43 | void delete(BankQuestion bq);
44 |
45 | int importChoiceFromTxt(File txtFile);
46 | int importBlankFromTxt(File txtFile);
47 | int importJudgeFromTxt(File txtFile);
48 | }
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/ExamQuestionAnswer.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import java.util.Date;
4 |
5 | import javax.persistence.CascadeType;
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 | import javax.persistence.JoinColumn;
11 | import javax.persistence.ManyToOne;
12 | @Entity
13 | public class ExamQuestionAnswer {
14 | @Id
15 | @GeneratedValue(strategy=GenerationType.IDENTITY)
16 | private int id;
17 |
18 | @ManyToOne(cascade=CascadeType.ALL)
19 | @JoinColumn(name="exam_question_id")
20 | private ExamQuestion examQuestion;
21 |
22 | @ManyToOne(cascade=CascadeType.ALL)
23 | @JoinColumn(name="student_id")
24 | private Student student;
25 |
26 | private String answer;
27 |
28 | private Date answerDate;
29 |
30 | public ExamQuestionAnswer(){}
31 |
32 | public ExamQuestionAnswer(ExamQuestion examQuestion, Student student, String answer) {
33 | this.examQuestion = examQuestion;
34 | this.student = student;
35 | this.answer = answer;
36 | this.answerDate = new Date();
37 | }
38 |
39 | public int getId() {
40 | return id;
41 | }
42 |
43 | public void setId(int id) {
44 | this.id = id;
45 | }
46 |
47 | public ExamQuestion getExamQuestion() {
48 | return examQuestion;
49 | }
50 |
51 | public void setExamQuestion(ExamQuestion examQuestion) {
52 | this.examQuestion = examQuestion;
53 | }
54 |
55 | public Student getStudent() {
56 | return student;
57 | }
58 |
59 | public void setStudent(Student student) {
60 | this.student = student;
61 | }
62 |
63 | public String getAnswer() {
64 | return this.answer;
65 | }
66 |
67 | public void setAnswer(String answer) {
68 | this.answer = answer;
69 | }
70 |
71 | public Date getAnswerDate() {
72 | return answerDate;
73 | }
74 |
75 | public void setAnswerDate(Date answerDate) {
76 | this.answerDate = answerDate;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/PushBroadcastMessageAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import java.util.List;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.context.annotation.Scope;
8 | import org.springframework.stereotype.Component;
9 |
10 | import com.opensymphony.xwork2.ActionContext;
11 | import com.opensymphony.xwork2.ActionSupport;
12 |
13 | import cn.lynu.lyq.java_exam.entity.Student;
14 | import cn.lynu.lyq.java_exam.websocket.BroadcastServer;
15 |
16 | @Component("pushBroadcastMessage")
17 | @Scope("prototype")
18 | public class PushBroadcastMessageAction extends ActionSupport {
19 |
20 | private static final long serialVersionUID = 3979239568384667934L;
21 |
22 | private final static Logger logger = LoggerFactory.getLogger(PushBroadcastMessageAction.class);
23 |
24 | private String message;
25 |
26 | private List broadcastStudentList;
27 |
28 | public String getMessage() {
29 | return message;
30 | }
31 |
32 | public void setMessage(String message) {
33 | this.message = message;
34 | }
35 |
36 | public List getBroadcastStudentList() {
37 | return broadcastStudentList;
38 | }
39 |
40 | public void setBroadcastStudentList(List broadcastStudentList) {
41 | this.broadcastStudentList = broadcastStudentList;
42 | }
43 |
44 | @Override
45 | public String execute(){
46 | logger.info("进入发送广播消息");
47 | ActionContext ctx =ActionContext.getContext();
48 | if(ctx.getSession().containsKey("USER_INFO")){
49 | Student s1=(Student)ctx.getSession().get("USER_INFO");
50 | if(s1.getRole()!=1){
51 | this.addActionError("您没有管理权限!");
52 | return ERROR;
53 | }else{
54 | return SUCCESS;
55 | }
56 | }else{
57 | this.addActionError("您还没有登录,请登录后再点击进入");
58 | return ERROR;
59 | }
60 |
61 | }
62 |
63 | public String executeForSend() {
64 | logger.info("开始发送广播消息");
65 | broadcastStudentList = BroadcastServer.broadcastMessage(message);
66 | return SUCCESS;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/UserLoginAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.context.annotation.Scope;
8 | import org.springframework.stereotype.Component;
9 |
10 | import com.opensymphony.xwork2.ActionContext;
11 | import com.opensymphony.xwork2.ActionSupport;
12 |
13 | import cn.lynu.lyq.java_exam.dao.StudentDao;
14 | import cn.lynu.lyq.java_exam.entity.Student;
15 | @Component("userLogin")
16 | @Scope("prototype")
17 | public class UserLoginAction extends ActionSupport {
18 | private static final long serialVersionUID = 5090548832375142158L;
19 | private final static Logger logger = LoggerFactory.getLogger(UserLoginAction.class);
20 |
21 | private String registerNo;
22 | private String password;
23 | private String username;
24 | @Resource
25 | private StudentDao studentDao;
26 |
27 | public String getRegisterNo() {
28 | return registerNo;
29 | }
30 | public void setRegisterNo(String registerNo) {
31 | this.registerNo = registerNo;
32 | }
33 | public String getPassword() {
34 | return password;
35 | }
36 | public void setPassword(String password) {
37 | this.password = password;
38 | }
39 | public String getUsername() {
40 | return username;
41 | }
42 | public void setUsername(String username) {
43 | this.username = username;
44 | }
45 |
46 | @Override
47 | public String execute() throws Exception {
48 | logger.info("用户登陆");
49 | Student stu = studentDao.findByRegNoAndPassword(registerNo, password);
50 | if(stu!=null){
51 | username=stu.getName();
52 | ActionContext ctx=ActionContext.getContext();
53 | ctx.getSession().put("USER_INFO", stu);
54 | }else{
55 | this.addActionError("学号或密码错误,请重新输入!");
56 | }
57 | return SUCCESS;
58 | }
59 |
60 | public String logout() throws Exception{
61 | logger.info("用户退出登陆");
62 | ActionContext ctx=ActionContext.getContext();
63 | ctx.getSession().remove("USER_INFO");
64 | this.addActionMessage("退出登陆成功!");
65 | return SUCCESS;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/test/BarChartTest.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.test;
2 |
3 | import java.awt.Font;
4 | import java.io.File;
5 | import java.io.IOException;
6 |
7 | import org.jfree.chart.ChartFactory;
8 | import org.jfree.chart.ChartUtilities;
9 | import org.jfree.chart.JFreeChart;
10 | import org.jfree.chart.plot.PiePlot;
11 | import org.jfree.chart.title.LegendTitle;
12 | import org.jfree.chart.title.TextTitle;
13 | import org.jfree.data.general.DefaultPieDataset;
14 |
15 | public class BarChartTest {
16 |
17 | public static void main(String[] args) throws IOException {
18 | DefaultPieDataset dataset = new DefaultPieDataset();
19 | dataset.setValue("B(张三,李四)", new Double(20));
20 | dataset.setValue("A(牛八,牛九)", new Double(20));
21 | dataset.setValue("C(胡十,胡九,胡瓜,胡弄)", new Double(40));
22 | dataset.setValue("D(邓三)", new Double(10));
23 |
24 | JFreeChart chart = ChartFactory.createPieChart("本题正确答案:C", // chart title
25 | dataset, // data
26 | false, // include legend
27 | false, false);
28 | setChartProperties(chart);
29 | ChartUtilities.saveChartAsPNG(new File("d:\\testPie.png"), chart, 600, 400);
30 | }
31 |
32 | /**
33 | * 设置Chart属性,可解决乱码问题
34 | * @param chart 统计图标
35 | */
36 | private static void setChartProperties(JFreeChart chart){
37 |
38 | //三个部分设置字体的方法分别如下:
39 | TextTitle textTitle = chart.getTitle();
40 | textTitle.setFont(new Font("SimHei", Font.PLAIN, 20));
41 | LegendTitle legend = chart.getLegend();
42 | if (legend != null) {
43 | legend.setItemFont(new Font("Microsoft YaHei", Font.PLAIN, 15));
44 | }
45 | PiePlot pie = (PiePlot) chart.getPlot();
46 | pie.setLabelFont(new Font("Microsoft YaHei", Font.PLAIN, 15));
47 | pie.setNoDataMessage("No data available");
48 | //设置PieChart是否显示为圆形
49 | pie.setCircular(true);
50 | // 间距
51 | pie.setLabelGap(0.05D);
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/impl/GradeDaoImpl.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao.impl;
2 |
3 | import java.util.List;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.hibernate.Query;
8 | import org.hibernate.SessionFactory;
9 | import org.slf4j.Logger;
10 | import org.slf4j.LoggerFactory;
11 | import org.springframework.stereotype.Component;
12 | import org.springframework.transaction.annotation.Propagation;
13 | import org.springframework.transaction.annotation.Transactional;
14 |
15 | import cn.lynu.lyq.java_exam.dao.GradeDao;
16 | import cn.lynu.lyq.java_exam.entity.Grade;
17 |
18 | @Component("gradeDao")
19 | @Transactional
20 |
21 | public class GradeDaoImpl implements GradeDao {
22 | private final static Logger logger = LoggerFactory.getLogger(GradeDaoImpl.class);
23 | @Resource
24 | private SessionFactory sessionFactory;
25 |
26 | public void setSessionFactory(SessionFactory sessionFactory) {
27 | this.sessionFactory = sessionFactory;
28 | }
29 |
30 | @Override
31 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
32 | public Grade findById(int id) {
33 | Grade g = sessionFactory.getCurrentSession().get(Grade.class, id);
34 | return g;
35 | }
36 |
37 | @SuppressWarnings("unchecked")
38 | @Override
39 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
40 | public List findAll() {
41 | Query q=sessionFactory.getCurrentSession().createQuery("from Grade");
42 | return q.list();
43 | }
44 |
45 | @SuppressWarnings("unchecked")
46 | @Override
47 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
48 | public List findByName(String name){
49 | logger.debug("name="+name);
50 | Query q=sessionFactory.getCurrentSession().createQuery("from Grade where name=?0");
51 | q.setString("0", name);
52 | return q.list();
53 | }
54 |
55 | @Override
56 | public void save(Grade g){
57 | sessionFactory.getCurrentSession().save(g);
58 | }
59 |
60 | @Override
61 | public void update(Grade g){
62 | sessionFactory.getCurrentSession().update(g);
63 | }
64 |
65 | @Override
66 | public void delete(Grade g){
67 | sessionFactory.getCurrentSession().delete(g);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/UpdateStrategyScoreAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.context.annotation.Scope;
8 | import org.springframework.stereotype.Component;
9 |
10 | import com.opensymphony.xwork2.ActionSupport;
11 |
12 | import cn.lynu.lyq.java_exam.dao.ExamStrategyDao;
13 | import cn.lynu.lyq.java_exam.entity.ExamStrategy;
14 |
15 | @Component("updateStrategyScore")
16 | @Scope("prototype")
17 | public class UpdateStrategyScoreAction extends ActionSupport{
18 | private static final long serialVersionUID = -6798232379261444727L;
19 | private final static Logger logger = LoggerFactory.getLogger(UpdateStrategyScoreAction.class);
20 | @Resource
21 | private ExamStrategyDao examStrategyDao;
22 | private int score;
23 | private int strategyId;
24 | private ExamStrategy updatedStrategy;
25 |
26 | public int getScore() {
27 | return score;
28 | }
29 | public void setScore(int score) {
30 | this.score = score;
31 | }
32 |
33 | public int getStrategyId() {
34 | return strategyId;
35 | }
36 |
37 | public void setStrategyId(int strategyId) {
38 | this.strategyId = strategyId;
39 | }
40 | public ExamStrategy getUpdatedStrategy() {
41 | return updatedStrategy;
42 | }
43 | public void setUpdatedStrategy(ExamStrategy updatedStrategy) {
44 | this.updatedStrategy = updatedStrategy;
45 | }
46 |
47 | public String updateForChoice(){
48 | logger.info("更新选择题策略");
49 | updatedStrategy = examStrategyDao.findById(strategyId);
50 | updatedStrategy.setChoicePerScore(score);
51 | examStrategyDao.update(updatedStrategy);
52 | return SUCCESS;
53 | }
54 |
55 | public String updateForBlank(){
56 | logger.info("更新填空题策略");
57 | updatedStrategy = examStrategyDao.findById(strategyId);
58 | updatedStrategy.setBlankPerScore(score);
59 | examStrategyDao.update(updatedStrategy);
60 | return SUCCESS;
61 | }
62 |
63 | public String updateForJudge(){
64 | logger.info("更新判断题策略");
65 | updatedStrategy = examStrategyDao.findById(strategyId);
66 | updatedStrategy.setJudgePerScore(score);
67 | examStrategyDao.update(updatedStrategy);
68 | return SUCCESS;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/StudentImportAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import java.io.File;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.context.annotation.Scope;
10 | import org.springframework.stereotype.Component;
11 |
12 | import com.opensymphony.xwork2.ActionSupport;
13 |
14 | import cn.lynu.lyq.java_exam.dao.StudentDao;
15 | @Component("studentImport")
16 | @Scope("prototype")
17 | public class StudentImportAction extends ActionSupport {
18 | private static final long serialVersionUID = 3132888016394172355L;
19 | private final static Logger logger = LoggerFactory.getLogger(StudentImportAction.class);
20 |
21 | private File studentImportFile;
22 | private String studentImportFileFileName;//文件名
23 | private String studentImportFileContentType;//文件类型
24 | private String studentFilePath;
25 |
26 | @Resource
27 | private StudentDao studentDao;
28 |
29 | public File getStudentImportFile() {
30 | return studentImportFile;
31 | }
32 | public void setStudentImportFile(File studentImportFile) {
33 | this.studentImportFile = studentImportFile;
34 | }
35 | public String getStudentImportFileFileName() {
36 | return studentImportFileFileName;
37 | }
38 | public void setStudentImportFileFileName(String studentImportFileFileName) {
39 | this.studentImportFileFileName = studentImportFileFileName;
40 | }
41 | public String getStudentImportFileContentType() {
42 | return studentImportFileContentType;
43 | }
44 | public void setStudentImportFileContentType(String studentImportFileContentType) {
45 | this.studentImportFileContentType = studentImportFileContentType;
46 | }
47 | public String getStudentFilePath() {
48 | return studentFilePath;
49 | }
50 | public void setStudentFilePath(String studentFilePath) {
51 | this.studentFilePath = studentFilePath;
52 | }
53 |
54 | @Override
55 | public String execute() throws Exception {
56 | logger.info("学生信息导入");
57 | int cnt = studentDao.importFromTxt(studentImportFile);
58 | logger.debug("studentImportFile="+studentImportFile);
59 | logger.debug("studentFilePath="+studentFilePath);
60 | this.addActionMessage(cnt+"条学生信息已经导入");
61 | return SUCCESS;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/webapp/other/判断题_import_20170404.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应至少以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节或知识点
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示判断题题干描述,可以为多行
5 | ###### 注意,题干的第二行开始开头不能再用字母或数字(因已经被题干的首字符占用)
6 | ######题干结束后的一行,以三个>号开头(">>>")表示答案,用T表示真,F表示假
7 | ######所有题结束后最后一行应至少以6个#号开头("######"),后续不能有空行!
8 | ######
9 | ***Java语言基础***
10 | 1. Java中,h22是合法的变量名,而22h是不合法的变量名。( )
11 | >>>T
12 | ######
13 | ***Java语言基础***
14 | 2. Java中birthday和birthDay是两个不同的变量。( )。
15 | >>>T
16 | ######
17 | ***Java语言基础***
18 | 3. Java中,多行注释/* …*/中可以嵌套//的单行注释,
19 | 但不能嵌套/*… */的多行注释。( )
20 | >>>T
21 | ######
22 | ***Java语言基础***
23 | 4,Java表达式 5>7 || 3>=2的运算结果是true。( )
24 | >>>T
25 | ######
26 | ***Java语言基础***
27 | 5. Java语句int n=9/2;执行后,n的值是5。( )
28 | >>>F
29 | ######
30 | ***Java语言基础***
31 | 6. Java表达式 7>=7 ? 777 : 888的运算结果是888。( )
32 | >>>F
33 | ######
34 | ***Java语言基础***
35 | 7. 已知int型的Java变量int x=3;,那么执行完int y=x++;语句后,y的值是4。( )
36 | >>>F
37 | ######
38 | ***Java语言基础***
39 | 8. Java表达式0xC8-2的运算结果是198。( )
40 | >>>T
41 | ######
42 | ***Java语言基础***
43 | 9. 已知int型的Java变量int x=5;,那么执行完x%=3;语句后,x的值是2。( )
44 | >>>T
45 | ######
46 | ***Java语言基础***
47 | 10.Java源代码中出现的整型数5其默认类型是int。( )
48 | >>>T
49 | ######
50 | ***Java语言基础***
51 | 11.Java源代码中出现的浮点数值4.5其默认类型是float。( )
52 | >>>F
53 | ######
54 | ***Java语言基础***
55 | 12.Java中,int类型的数据可以直接赋值给double类型的变量,实现自动类型转换。( )
56 | >>>T
57 | ######
58 | ***Java语言基础***
59 | 13.Java中的boolean类型可以和int类型之间相互转换。( )
60 | >>>F
61 | ######
62 | ***Java语言基础***
63 | 14.Java的switch语句中可以没有default子句,该子句是可选的。( )
64 | >>>T
65 | ######
66 | ***Java语言基础***
67 | 15.Java的for循环语句中,for关键字后面的小括号()内三部分内容之间用逗号(,)分隔。( )
68 | >>>F
69 | ######
70 | ***Java语言基础***
71 | 16.在Java方法的内部不能调用自身方法。( )
72 | >>>F
73 | ######
74 | ***Java语言基础***
75 | 17.Java的数组声明并初始化语句int[ ] arrayX = (1, 7, 8, 5, 9); 是正确的。( )
76 | >>>F
77 | ######
78 | ***Java语言基础***
79 | 18.声明Java数组boolean[ ] boolArray = new boolean[3],那么boolArray[0]的值是false。( )
80 | >>>T
81 | ######
82 | ***Java语言基础***
83 | 19.声明并初始化二维数组int[ ][ ] dim2Array = { {1, 2}, {3, 4, 5}},则dim2Array[1][2]的值是2。( )
84 | >>>F
85 | ######
86 | ***Java语言基础***
87 | 20.Java在循环中出现的break语句的作用是结束本次循环,执行下一次循环。( )
88 | >>>F
89 | ######
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/impl/ExamStrategyDaoImpl.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao.impl;
2 |
3 | import java.util.List;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.hibernate.Query;
8 | import org.hibernate.SessionFactory;
9 | import org.slf4j.Logger;
10 | import org.slf4j.LoggerFactory;
11 | import org.springframework.stereotype.Component;
12 | import org.springframework.transaction.annotation.Propagation;
13 | import org.springframework.transaction.annotation.Transactional;
14 |
15 | import cn.lynu.lyq.java_exam.dao.ExamStrategyDao;
16 | import cn.lynu.lyq.java_exam.entity.Exam;
17 | import cn.lynu.lyq.java_exam.entity.ExamStrategy;
18 |
19 | @Component("examStrategyDao")
20 | @Transactional
21 | public class ExamStrategyDaoImpl implements ExamStrategyDao {
22 | private final static Logger logger = LoggerFactory.getLogger(ExamStrategyDaoImpl.class);
23 | @Resource
24 | private SessionFactory sessionFactory;
25 |
26 | public void setSessionFactory(SessionFactory sessionFactory) {
27 | this.sessionFactory = sessionFactory;
28 | }
29 |
30 | @SuppressWarnings("unchecked")
31 | @Override
32 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
33 | public List findAll(){
34 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamStrategy");
35 | return q.list();
36 | }
37 |
38 | @SuppressWarnings("unchecked")
39 | @Override
40 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
41 | public List findByExam(Exam exam) {
42 | logger.debug("exam="+exam);
43 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamStrategy where exam=?0");
44 | q.setParameter("0", exam);
45 | return q.list();
46 | }
47 |
48 | @Override
49 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
50 | public ExamStrategy findById(int id) {
51 | ExamStrategy es = sessionFactory.getCurrentSession().get(ExamStrategy.class, id);
52 | return es;
53 | }
54 |
55 | @Override
56 | public void save(ExamStrategy es){
57 | sessionFactory.getCurrentSession().save(es);
58 | }
59 |
60 | @Override
61 | public void update(ExamStrategy es){
62 | sessionFactory.getCurrentSession().update(es);
63 | }
64 |
65 | @Override
66 | public void delete(ExamStrategy es){
67 | sessionFactory.getCurrentSession().delete(es);
68 | }
69 |
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/webapp/examHandIn.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ taglib uri="/struts-tags" prefix="s" %>
4 |
5 |
6 |
7 |
8 |
9 | Java考试系统--试卷提交
10 |
11 |
12 |
13 |
14 |
24 |
25 |
26 | <%@ include file="include/header.jsp" %>
27 |
61 |
62 |
63 |
65 | <%@ include file="include/footer.jsp" %>
66 |
67 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/ChoiceDetailAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.context.annotation.Scope;
8 | import org.springframework.stereotype.Component;
9 |
10 | import com.opensymphony.xwork2.ActionContext;
11 | import com.opensymphony.xwork2.ActionSupport;
12 |
13 | import cn.lynu.lyq.java_exam.dao.BankQuestionDao;
14 | import cn.lynu.lyq.java_exam.entity.BankChoiceQuestion;
15 |
16 | @Component("choiceDetail")
17 | @Scope("prototype")
18 | public class ChoiceDetailAction extends ActionSupport {
19 |
20 | private static final long serialVersionUID = 3023312680596200270L;
21 | private final static Logger logger = LoggerFactory.getLogger(ChoiceDetailAction.class);
22 |
23 | private BankChoiceQuestion question;
24 | @Resource
25 | private BankQuestionDao bankQuestionDao;
26 |
27 | public BankChoiceQuestion getQuestion() {
28 | return question;
29 | }
30 | public void setQuestion(BankChoiceQuestion question) {
31 | this.question = question;
32 | }
33 |
34 | @Override
35 | public String execute() throws Exception {
36 | ActionContext ctx = ActionContext.getContext();
37 | String qid = ctx.getParameters().get("qid").getValue();
38 | logger.info("根据id查找选择题详细");
39 | question = bankQuestionDao.findChoiceById(Integer.parseInt(qid.trim()));
40 |
41 | //显示前,如果有类似"A."的字符,就删掉
42 | String choiceA = question.getChoiceA();
43 | String choiceB = question.getChoiceB();
44 | String choiceC = question.getChoiceC();
45 | String choiceD = question.getChoiceD();
46 | question.setChoiceA(deleteOptionLetter(choiceA));
47 | question.setChoiceB(deleteOptionLetter(choiceB));
48 | question.setChoiceC(deleteOptionLetter(choiceC));
49 | question.setChoiceD(deleteOptionLetter(choiceD));
50 |
51 | return SUCCESS;
52 | }
53 |
54 | private String deleteOptionLetter(String choiceOption){
55 | if(choiceOption!=null && choiceOption.length()>1){
56 | choiceOption = choiceOption.trim();
57 | char optionLetter = choiceOption.charAt(0);
58 | char dotChar = choiceOption.charAt(1);
59 | if("ABCDEFGH".contains(String.valueOf(optionLetter)) )
60 | choiceOption = choiceOption.substring(1);
61 | if(dotChar=='.' || dotChar=='.')
62 | choiceOption = choiceOption.substring(1);
63 | return choiceOption.trim();
64 | }else
65 | return "";
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/webapp/blankFillingDetail.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 |
4 |
5 |
6 |
7 | Java考试系统--填空题详细
8 |
9 |
10 |
11 |
12 |
47 |
48 |
49 | <%@ include file="include/header.jsp" %>
50 |
51 |
52 |
53 | |
54 |
58 | |
59 |
60 |
61 | |
62 |
63 |
64 | |
65 | 答案:
66 | |
67 |
68 |
69 |
70 | |
71 |
75 | |
76 |
77 |
78 |
79 |
80 |
81 | <%@ include file="include/footer.jsp" %>
82 |
83 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/utils/PropertyUtils.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.utils;
2 |
3 | import java.io.File;
4 | import java.io.FileInputStream;
5 | import java.io.FileOutputStream;
6 | import java.io.IOException;
7 | import java.io.InputStream;
8 | import java.io.OutputStream;
9 | import java.net.URISyntaxException;
10 | import java.net.URL;
11 | import java.text.SimpleDateFormat;
12 | import java.util.Date;
13 | import java.util.Properties;
14 |
15 | import org.slf4j.Logger;
16 | import org.slf4j.LoggerFactory;
17 |
18 | public class PropertyUtils {
19 | private final static Logger logger = LoggerFactory.getLogger(PropertyUtils.class);
20 | private static InputStream is;
21 | private static OutputStream os;
22 | private static File propFile;
23 |
24 | public static String getProperty(String key){
25 | Properties prop = new Properties();
26 | try {
27 | propFile = new File(new URL(PropertyUtils.class.getResource("/")+"mysetting.properties").toURI());
28 | logger.debug(propFile.getAbsolutePath());
29 | is = new FileInputStream(propFile);
30 | prop.load(is);
31 | return prop.getProperty(key);
32 | } catch (Exception e) {
33 | e.printStackTrace();
34 | return null;
35 | }
36 | }
37 |
38 | public static void setProperty(String key, String value){
39 | Properties prop = new Properties();
40 | try {
41 | propFile = new File(new URL(PropertyUtils.class.getResource("/")+"mysetting.properties").toURI());
42 | is = new FileInputStream(propFile);
43 | prop.load(is);
44 |
45 | logger.debug(prop.keySet().toString());
46 | prop.setProperty(key, value);
47 | os = new FileOutputStream(propFile);
48 | prop.store(os, "modified at "+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
49 | } catch (Exception e) {
50 | e.printStackTrace();
51 | }
52 | }
53 |
54 | public static void main(String[] args) throws IOException, URISyntaxException {
55 | // InputStream is = ClassLoader.getSystemResourceAsStream("mysetting.properties");
56 | // Properties prop = new Properties();
57 | // prop.load(is);
58 | // prop.list(System.out);
59 | //
60 | // FileOutputStream fos = new FileOutputStream(new File(ClassLoader.getSystemResource("mysetting.properties").toURI()));
61 | // prop.setProperty("lyqtest1", "bbb");
62 | // prop.store(fos, "store something2");
63 | // prop.list(System.out);
64 |
65 | String test1 = getProperty("lyqtest1");
66 | logger.debug(test1);
67 | setProperty("lyqtest1","bbbbb");
68 |
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/websocket/BroadcastServer.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.websocket;
2 |
3 | import java.util.List;
4 | import java.util.concurrent.CopyOnWriteArrayList;
5 |
6 | import javax.servlet.http.HttpSession;
7 | import javax.websocket.EndpointConfig;
8 | import javax.websocket.OnClose;
9 | import javax.websocket.OnError;
10 | import javax.websocket.OnMessage;
11 | import javax.websocket.OnOpen;
12 | import javax.websocket.Session;
13 | import javax.websocket.server.ServerEndpoint;
14 |
15 | import org.slf4j.Logger;
16 | import org.slf4j.LoggerFactory;
17 | import org.springframework.context.annotation.Scope;
18 | import org.springframework.stereotype.Controller;
19 |
20 | import cn.lynu.lyq.java_exam.entity.Student;
21 |
22 | @Controller
23 | @Scope("prototype")
24 | @ServerEndpoint(value="/websocket/broadcast",configurator=GetHttpSessionConfigurator.class)
25 | public class BroadcastServer {
26 | private Session session;
27 | private Student student;
28 | private final static Logger logger = LoggerFactory.getLogger(BroadcastServer.class);
29 |
30 | private static List broadcastList = new CopyOnWriteArrayList<>();
31 | private static List broadcastStudentList = new CopyOnWriteArrayList<>();
32 |
33 | @OnOpen
34 | public void onOpen(Session session, EndpointConfig config){
35 | logger.debug("BroadcastServer onOpen");
36 | HttpSession httpSession = (HttpSession)config.getUserProperties().get(HttpSession.class.getName());
37 | Student student = (Student)httpSession.getAttribute("USER_INFO");
38 | if(student!=null){
39 | this.session = session;
40 | this.student = student;
41 | broadcastList.add(this);
42 | broadcastStudentList.add(student);
43 | }
44 | }
45 |
46 | @OnMessage
47 | public void onMessage(String message){
48 | logger.info("BroadcastServer onMessage");
49 | // broadcastMessage(message);
50 | }
51 |
52 | @OnClose
53 | public void onClose(){
54 | logger.debug("BroadcastServer onClose");
55 | broadcastList.remove(this);
56 | if(student!=null)
57 | broadcastStudentList.remove(student);
58 | }
59 |
60 | @OnError
61 | public void onError(Throwable t){
62 | logger.debug("websocket onError:"+t.getMessage());
63 | }
64 |
65 | public static List broadcastMessage(String message){
66 | for(BroadcastServer item:broadcastList){
67 | item.session.getAsyncRemote().sendText(message!=null?message:"");
68 | }
69 | return broadcastStudentList;
70 | }
71 |
72 | //
73 | public String execute(){
74 | return "success";
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/Student.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import javax.persistence.CascadeType;
4 | import javax.persistence.Entity;
5 | import javax.persistence.GeneratedValue;
6 | import javax.persistence.GenerationType;
7 | import javax.persistence.Id;
8 | import javax.persistence.JoinColumn;
9 | import javax.persistence.ManyToOne;
10 |
11 | @Entity
12 | public class Student {
13 | @Id
14 | @GeneratedValue(strategy=GenerationType.IDENTITY)
15 | private int id;
16 | private String registerNo;
17 | private String name;
18 | private boolean gender;
19 | private String password;
20 | @ManyToOne(cascade=CascadeType.ALL)
21 | @JoinColumn(name="grade_id")
22 | private Grade grade;
23 | private int role; //权限 role=0表示学生, role=1表示“教师或管理员”
24 |
25 | public Student(){}
26 |
27 | public Student(String name, String registerNo, boolean gender, String password) {
28 | this.name = name;
29 | this.gender = gender;
30 | this.registerNo = registerNo;
31 | this.password = password;
32 | }
33 | public Student(String name, String registerNo, boolean gender, String password, Grade grade) {
34 | this.name = name;
35 | this.gender = gender;
36 | this.registerNo = registerNo;
37 | this.password = password;
38 | this.grade = grade;
39 | }
40 |
41 | public int getId() {
42 | return id;
43 | }
44 | public void setId(int id) {
45 | this.id = id;
46 | }
47 | public String getName() {
48 | return name;
49 | }
50 | public void setName(String name) {
51 | this.name = name;
52 | }
53 | public String getRegisterNo() {
54 | return registerNo;
55 | }
56 | public void setRegisterNo(String registerNo) {
57 | this.registerNo = registerNo;
58 | }
59 |
60 | public boolean isGender() {
61 | return gender;
62 | }
63 | public void setGender(boolean gender) {
64 | this.gender = gender;
65 | }
66 | public String getPassword() {
67 | return password;
68 | }
69 | public void setPassword(String password) {
70 | this.password = password;
71 | }
72 | public Grade getGrade() {
73 | return grade;
74 | }
75 | public void setGrade(Grade grade) {
76 | this.grade = grade;
77 | }
78 | public int getRole() {
79 | return role;
80 | }
81 | public void setRole(int role) {
82 | this.role = role;
83 | }
84 |
85 | @Override
86 | public String toString() {
87 | return "Student [id=" + id + ", "
88 | + "name=" + name
89 | + "registerNo=" + registerNo
90 | + ", gender=" + gender
91 | + ", password=" + password
92 | + ", grade=" + grade
93 | + ", role="+ role + "]";
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/test/WordGernerateTest1.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.test;
2 |
3 | import java.awt.image.BufferedImage;
4 | import java.io.File;
5 | import java.io.FileInputStream;
6 | import java.io.FileOutputStream;
7 | import java.io.IOException;
8 | import java.io.OutputStream;
9 |
10 | import javax.imageio.ImageIO;
11 |
12 | import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
13 | import org.apache.poi.util.Units;
14 | import org.apache.poi.xwpf.usermodel.XWPFDocument;
15 | import org.apache.poi.xwpf.usermodel.XWPFParagraph;
16 | import org.apache.poi.xwpf.usermodel.XWPFRun;
17 |
18 | public class WordGernerateTest1 {
19 |
20 | public static void main(String[] args) throws IOException {
21 | File file = new File("c:\\test001.docx");
22 | // InputStream is = new FileInputStream();
23 | XWPFDocument xdoc = new XWPFDocument();
24 | XWPFParagraph xpara = xdoc.createParagraph();
25 |
26 | // 一个XWPFRun代表具有相同属性的一个区域。
27 | XWPFRun run = xpara.createRun();
28 | run.setBold(true); // 加粗
29 | run.setText("加粗的内容");
30 |
31 | run = xpara.createRun();
32 | run.setColor("FF0000");
33 | run.setFontSize(15);
34 | run.setText("\n\n插入内容。");
35 |
36 | xpara = xdoc.createParagraph();
37 | xpara.setFirstLineIndent(20);
38 | run = xpara.createRun();
39 | run.setText("aaaaa");
40 | run.addCarriageReturn();
41 |
42 | addPictureToRun(run, new File("c:\\test1.jpg"));
43 |
44 | run.addCarriageReturn();
45 | run.setText("dadfafa大家好");
46 | addPictureToRun(run, new File("c:\\jiayou.jpg"));
47 | run.setText("我在图片后!");
48 |
49 | OutputStream os = new FileOutputStream(file);
50 | xdoc.write(os);
51 |
52 | xdoc.close();
53 | os.close();
54 |
55 | }
56 |
57 | public static void addPictureToRun(XWPFRun run, File picFile){
58 | try {
59 | BufferedImage bi = ImageIO.read(picFile);
60 | FileInputStream fis = new FileInputStream(picFile);
61 |
62 | int picType = XWPFDocument.PICTURE_TYPE_PNG;
63 | if(picFile.getName().endsWith(".jpg")){
64 | picType = XWPFDocument.PICTURE_TYPE_JPEG;
65 | }else if(picFile.getName().endsWith(".png")){
66 | picType = XWPFDocument.PICTURE_TYPE_PNG;
67 | }else if(picFile.getName().endsWith("gif")){
68 | picType = XWPFDocument.PICTURE_TYPE_GIF;
69 | }
70 | // System.out.println(bi.getWidth());
71 | // System.out.println(bi.getHeight());
72 | run.addPicture(fis, picType, picFile.getAbsolutePath(), Units.toEMU(bi.getWidth()),
73 | Units.toEMU(bi.getHeight()));
74 | fis.close();
75 | } catch (InvalidFormatException|IOException e) {
76 | e.printStackTrace();
77 | }
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/BankQuestion.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import java.util.Date;
4 |
5 | import javax.persistence.GeneratedValue;
6 | import javax.persistence.GenerationType;
7 | import javax.persistence.Id;
8 | import javax.persistence.MappedSuperclass;
9 |
10 | @MappedSuperclass
11 | public abstract class BankQuestion {
12 | @Id
13 | @GeneratedValue(strategy=GenerationType.IDENTITY)
14 | private int id;
15 | private String name;//题目标题,可省略
16 | private String content; //题干,对于填空题、判断题就是题目本身,
17 | //如果题目包含图片,这是图片的存放路径;如果题目包含多张图片,则用“[pic1,pic2,...]”的语法
18 | private String picLocation;
19 | private String description;//对题目的额外要求(例如,该题目必须用英语回答,等)
20 | private String answer;
21 | private Date createDate;
22 | private String contributor;//出题人,或题目贡献者,如果有的话
23 | private String knowledgePoint;//知识点
24 | private String memo;
25 | private int composeFlag;//组卷标志:(目前只用于题目是否参与随机组卷,1表示用于随机组卷)
26 |
27 | public int getId() {
28 | return id;
29 | }
30 | public void setId(int id) {
31 | this.id = id;
32 | }
33 | public String getName() {
34 | return name;
35 | }
36 | public void setName(String name) {
37 | this.name = name;
38 | }
39 | public String getContent() {
40 | return content;
41 | }
42 | public void setContent(String content) {
43 | this.content = content;
44 | }
45 | public String getPicLocation() {
46 | return picLocation;
47 | }
48 | public void setPicLocation(String picLocation) {
49 | this.picLocation = picLocation;
50 | }
51 | public String getDescription() {
52 | return description;
53 | }
54 | public void setDescription(String description) {
55 | this.description = description;
56 | }
57 | public String getAnswer() {
58 | return answer;
59 | }
60 | public void setAnswer(String answer) {
61 | this.answer = answer;
62 | }
63 | public Date getCreateDate() {
64 | return createDate;
65 | }
66 | public void setCreateDate(Date createDate) {
67 | this.createDate = createDate;
68 | }
69 | public String getContributor() {
70 | return contributor;
71 | }
72 | public void setContributor(String contributor) {
73 | this.contributor = contributor;
74 | }
75 | public String getKnowledgePoint() {
76 | return knowledgePoint;
77 | }
78 | public void setKnowledgePoint(String knowledgePoint) {
79 | this.knowledgePoint = knowledgePoint;
80 | }
81 | public String getMemo() {
82 | return memo;
83 | }
84 | public void setMemo(String memo) {
85 | this.memo = memo;
86 | }
87 | public int getComposeFlag() {
88 | return composeFlag;
89 | }
90 | public void setComposeFlag(int composeFlag) {
91 | this.composeFlag = composeFlag;
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/src/main/webapp/judgeDetail.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 |
4 |
5 |
6 |
7 | Java考试系统--判断题详细
8 |
9 |
10 |
11 |
12 |
13 |
48 |
49 |
50 | <%@ include file="include/header.jsp" %>
51 |
52 |
53 |
54 | |
55 |
59 | |
60 |
61 |
62 | |
63 |
64 |
65 | |
66 | 答案:
67 |
68 |
69 |
70 |
71 |
72 |
73 | |
74 |
75 |
76 |
77 | |
78 |
82 | |
83 |
84 |
85 |
86 |
87 |
88 | <%@ include file="include/footer.jsp" %>
89 |
90 |
--------------------------------------------------------------------------------
/src/main/webapp/changeSettings.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ taglib uri="/struts-tags" prefix="s" %>
4 |
5 |
6 |
7 |
8 | Java考试系统--修改系统设置
9 |
10 |
11 |
12 |
13 |
14 |
15 | <%@ include file="include/header.jsp" %>
16 |
47 | <%@ include file="include/footer.jsp" %>
48 |
49 |
50 |
51 |
52 |
57 |
58 |
59 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/src/main/webapp/other/2016级电商3班_学生51人_import.txt:
--------------------------------------------------------------------------------
1 | #请使用UTF-8无BOM格式编码,推荐用Notepad++编辑和转换
2 | #如果某行的第一个字符为#号的表示注释行,会被忽略
3 | #最好不要有空行,一般情况下空行(或只包含空格的行)会被忽略
4 | #下面是标题行,请注意只能使用“学号,姓名,性别,班级,密码”这些字段名,用英文半角标点逗号,或空格分隔(不要用中文标点)
5 | #,其中学号和姓名不可省略
6 | 学号,姓名,性别,班级,密码
7 | 162244007 杨杰斯 女 2016级电子商务3班 111111
8 | 162244008 李红雨 女 2016级电子商务3班 111111
9 | 162244079 曹梦如 女 2016级电子商务3班 111111
10 | 162244080 赵敬芳 女 2016级电子商务3班 111111
11 | 162244081 刘琪 女 2016级电子商务3班 111111
12 | 162244082 陈佳琳 女 2016级电子商务3班 111111
13 | 162244083 李佳婷 女 2016级电子商务3班 111111
14 | 162244084 彭方方 女 2016级电子商务3班 111111
15 | 162244085 高齐曼 女 2016级电子商务3班 111111
16 | 162244086 杨鑫鑫 女 2016级电子商务3班 111111
17 | 162244087 吴晨莹 女 2016级电子商务3班 111111
18 | 162244088 庞凯童 女 2016级电子商务3班 111111
19 | 162244089 喻灵杰 女 2016级电子商务3班 111111
20 | 162244090 申林瑛 女 2016级电子商务3班 111111
21 | 162244091 张亚新 女 2016级电子商务3班 111111
22 | 162244093 齐宁宁 女 2016级电子商务3班 111111
23 | 162244094 周迪 女 2016级电子商务3班 111111
24 | 162244095 王倩楠 女 2016级电子商务3班 111111
25 | 162244096 李文慧 女 2016级电子商务3班 111111
26 | 162244097 闫阳阳 女 2016级电子商务3班 111111
27 | 162244098 鲍慧 女 2016级电子商务3班 111111
28 | 162244099 周利芬 女 2016级电子商务3班 111111
29 | 162244100 王梦珂 女 2016级电子商务3班 111111
30 | 162244101 郭盈盈 女 2016级电子商务3班 111111
31 | 162244102 王新艳 女 2016级电子商务3班 111111
32 | 162244103 张乐乐 女 2016级电子商务3班 111111
33 | 162244104 曾庆兰 女 2016级电子商务3班 111111
34 | 162244105 刘帅娜 女 2016级电子商务3班 111111
35 | 162244106 张梦莹 女 2016级电子商务3班 111111
36 | 162244107 马梦晓 女 2016级电子商务3班 111111
37 | 162244108 皇甫苗苗 女 2016级电子商务3班 111111
38 | 162244109 董菁 女 2016级电子商务3班 111111
39 | 162244110 屠陆一 女 2016级电子商务3班 111111
40 | 162244111 王艳娇 女 2016级电子商务3班 111111
41 | 162244112 岳璐璐 女 2016级电子商务3班 111111
42 | 162244113 宋靖雯 女 2016级电子商务3班 111111
43 | 162244114 丁淋淋 女 2016级电子商务3班 111111
44 | 162244133 王压兵 男 2016级电子商务3班 111111
45 | 162244134 许光辉 男 2016级电子商务3班 111111
46 | 162244135 陶威 男 2016级电子商务3班 111111
47 | 162244136 刘晨曦 男 2016级电子商务3班 111111
48 | 162244137 朱磊 男 2016级电子商务3班 111111
49 | 162244138 李东卿 男 2016级电子商务3班 111111
50 | 162244139 李博 男 2016级电子商务3班 111111
51 | 162244140 付金旺 男 2016级电子商务3班 111111
52 | 162244141 薛俊俊 男 2016级电子商务3班 111111
53 | 162244142 姜亚明 男 2016级电子商务3班 111111
54 | 162244151 贺成兰 女 2016级电子商务3班 111111
55 | 162244152 方蕊 女 2016级电子商务3班 111111
56 | 162244153 寇雪慧 女 2016级电子商务3班 111111
57 | 162244154 马啸天 男 2016级电子商务3班 111111
58 |
59 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/ExamStrategy.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import javax.persistence.CascadeType;
4 | import javax.persistence.Entity;
5 | import javax.persistence.GeneratedValue;
6 | import javax.persistence.GenerationType;
7 | import javax.persistence.Id;
8 | import javax.persistence.JoinColumn;
9 | import javax.persistence.ManyToOne;
10 | @Entity
11 | public class ExamStrategy {
12 | @Id
13 | @GeneratedValue(strategy=GenerationType.IDENTITY)
14 | private int id;
15 | @ManyToOne(cascade=CascadeType.MERGE)
16 | @JoinColumn(name="exam_id")
17 | private Exam exam;
18 | private String name;
19 | private int choicePerScore;
20 | private int blankPerScore;
21 | private int judgePerScore;
22 | private String comment;
23 |
24 | public ExamStrategy(){}
25 |
26 | public ExamStrategy(Exam exam, String name, int choicePerScore, int blankPerScore, int judgePerScore,
27 | String comment) {
28 | this.exam = exam;
29 | this.name = name;
30 | this.choicePerScore = choicePerScore;
31 | this.blankPerScore = blankPerScore;
32 | this.judgePerScore = judgePerScore;
33 | this.comment = comment;
34 | }
35 |
36 |
37 |
38 | public int getId() {
39 | return id;
40 | }
41 |
42 | public void setId(int id) {
43 | this.id = id;
44 | }
45 |
46 | public Exam getExam() {
47 | return exam;
48 | }
49 |
50 | public void setExam(Exam exam) {
51 | this.exam = exam;
52 | }
53 |
54 | public String getName() {
55 | return name;
56 | }
57 |
58 | public void setName(String name) {
59 | this.name = name;
60 | }
61 |
62 | public int getChoicePerScore() {
63 | return choicePerScore;
64 | }
65 |
66 | public void setChoicePerScore(int choicePerScore) {
67 | this.choicePerScore = choicePerScore;
68 | }
69 |
70 | public int getBlankPerScore() {
71 | return blankPerScore;
72 | }
73 |
74 | public void setBlankPerScore(int blankPerScore) {
75 | this.blankPerScore = blankPerScore;
76 | }
77 |
78 | public int getJudgePerScore() {
79 | return judgePerScore;
80 | }
81 |
82 | public void setJudgePerScore(int judgePerScore) {
83 | this.judgePerScore = judgePerScore;
84 | }
85 |
86 | public String getComment() {
87 | return comment;
88 | }
89 |
90 | public void setComment(String comment) {
91 | this.comment = comment;
92 | }
93 |
94 | @Override
95 | public String toString() {
96 | return "ExamStrategy [id=" + id + ", exam=" + exam + ", name=" + name + ", choicePerScore=" + choicePerScore
97 | + ", blankPerScore=" + blankPerScore + ", judgePerScore=" + judgePerScore + ", comment=" + comment
98 | + "]";
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/src/main/webapp/examDetail.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ taglib uri="/struts-tags" prefix="s" %>
4 |
5 |
6 |
7 |
8 | 试卷详细
9 |
36 |
37 |
38 |
39 |
选择题
40 |
41 |
42 | #efefef#ffffff">
43 | | . |
44 | |
45 |
46 | #efefef#ffffff">
47 |
48 |
49 | | A. | |
50 | | B. | |
51 | | C. | |
52 | | D. | |
53 |
54 | |
55 |
56 | |
57 |
58 |
59 |
60 |
填空题
61 |
62 |
63 | #efefef#ffffff">
64 | | . |
65 | |
66 |
67 | |
68 |
69 |
70 |
71 |
判断题
72 |
73 |
74 | #efefef#ffffff">
75 | | . |
76 | |
77 |
78 | |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/src/main/webapp/broadcastMessage.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ taglib uri="/struts-tags" prefix="s" %>
4 |
5 |
6 |
7 |
8 | Java考试系统--推送广播消息
9 |
10 |
11 |
12 |
13 |
14 |
15 | <%@ include file="include/header.jsp" %>
16 |
34 | <%@ include file="include/footer.jsp" %>
35 |
36 |
37 |
38 |
59 |
60 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/src/main/webapp/examList.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ taglib uri="/struts-tags" prefix="s"%>
4 |
5 |
6 |
7 |
8 | Java考试系统--考试列表
9 |
10 |
11 |
12 |
13 |
43 |
44 |
45 | <%@ include file="include/header.jsp" %>
46 |
47 |
48 |
49 |
50 |
51 | | 序号 |
52 | 考试名称 |
53 | 说明 |
54 |
55 |
56 |
57 | #efefef#ffffff">
59 | |
60 | "> |
63 | |
64 |
65 |
66 |
67 |
68 |
69 | <%@ include file="include/footer.jsp" %>
70 |
71 |
72 |
73 |
74 |
93 |
94 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/ModifySettingsAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.context.annotation.Scope;
6 | import org.springframework.stereotype.Component;
7 |
8 | import com.opensymphony.xwork2.ActionContext;
9 | import com.opensymphony.xwork2.ActionSupport;
10 |
11 | import cn.lynu.lyq.java_exam.common.Constants;
12 | import cn.lynu.lyq.java_exam.entity.Student;
13 | import cn.lynu.lyq.java_exam.utils.PropertyUtils;
14 |
15 | @Component("modifySettings")
16 | @Scope("prototype")
17 | public class ModifySettingsAction extends ActionSupport {
18 |
19 | private static final long serialVersionUID = 793981621438306810L;
20 | private final static Logger logger = LoggerFactory.getLogger(ModifySettingsAction.class);
21 |
22 | private String defaultExamScheduledTime;
23 | private String examDetailAllowed;
24 | private String examTimeoutAutoSubmit;
25 |
26 | public String getDefaultExamScheduledTime() {
27 | return defaultExamScheduledTime;
28 | }
29 |
30 | public void setDefaultExamScheduledTime(String defaultExamScheduledTime) {
31 | this.defaultExamScheduledTime = defaultExamScheduledTime;
32 | }
33 |
34 | public String getExamDetailAllowed() {
35 | return examDetailAllowed;
36 | }
37 |
38 | public void setExamDetailAllowed(String examDetailAllowed) {
39 | this.examDetailAllowed = examDetailAllowed;
40 | }
41 |
42 | public String getExamTimeoutAutoSubmit() {
43 | return examTimeoutAutoSubmit;
44 | }
45 |
46 | public void setExamTimeoutAutoSubmit(String examTimeoutAutoSubmit) {
47 | this.examTimeoutAutoSubmit = examTimeoutAutoSubmit;
48 | }
49 |
50 | @Override
51 | public String execute(){
52 | logger.info("进入修改系统设置界面");
53 | ActionContext ctx =ActionContext.getContext();
54 | if(ctx.getSession().containsKey("USER_INFO")){
55 | Student s1=(Student)ctx.getSession().get("USER_INFO");
56 | if(s1.getRole()!=1){
57 | this.addActionError("您没有管理权限!");
58 | return ERROR;
59 | }else{
60 | defaultExamScheduledTime = PropertyUtils.getProperty(Constants.DEFAULT_EXAM_SCHEDULED_TIME);
61 | examDetailAllowed = PropertyUtils.getProperty(Constants.EXAM_DETAIL_ALLOWED);
62 | examTimeoutAutoSubmit = PropertyUtils.getProperty(Constants.EXAM_TIMEOUT_AUTOSUBMIT);
63 | return SUCCESS;
64 | }
65 | }else{
66 | this.addActionError("您还没有登录,请登录后再点击进入");
67 | return ERROR;
68 | }
69 |
70 | }
71 |
72 | public String executeForUpdate() {
73 | logger.info("开始修改系统设置");
74 | PropertyUtils.setProperty(Constants.DEFAULT_EXAM_SCHEDULED_TIME, defaultExamScheduledTime);
75 | PropertyUtils.setProperty(Constants.EXAM_DETAIL_ALLOWED, examDetailAllowed);
76 | PropertyUtils.setProperty(Constants.EXAM_TIMEOUT_AUTOSUBMIT, examTimeoutAutoSubmit);
77 | this.addActionMessage("系统设置修改成功!");
78 | return SUCCESS;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/UserChangePasswordAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.context.annotation.Scope;
8 | import org.springframework.stereotype.Component;
9 |
10 | import com.opensymphony.xwork2.ActionContext;
11 | import com.opensymphony.xwork2.ActionSupport;
12 |
13 | import cn.lynu.lyq.java_exam.dao.StudentDao;
14 | import cn.lynu.lyq.java_exam.entity.Student;
15 |
16 | @Component("userChangePassWord")
17 | @Scope("prototype")
18 | public class UserChangePasswordAction extends ActionSupport {
19 | private static final long serialVersionUID = -3797081971252346673L;
20 | private final static Logger logger = LoggerFactory.getLogger(UserChangePasswordAction.class);
21 |
22 | private String oldPassword;
23 | private String newPassword;
24 | private String newPassword2;
25 | @Resource
26 | private StudentDao studentDao;
27 |
28 | public String getOldPassword() {
29 | return oldPassword;
30 | }
31 |
32 | public void setOldPassword(String oldPassword) {
33 | this.oldPassword = oldPassword;
34 | }
35 |
36 | public String getNewPassword() {
37 | return newPassword;
38 | }
39 |
40 | public void setNewPassword(String newPassword) {
41 | this.newPassword = newPassword;
42 | }
43 |
44 | public String getNewPassword2() {
45 | return newPassword2;
46 | }
47 |
48 | public void setNewPassword2(String newPassword2) {
49 | this.newPassword2 = newPassword2;
50 | }
51 |
52 | @Override
53 | public void validate() {
54 | ActionContext ctx=ActionContext. getContext();
55 | Student stu = (Student)ctx.getSession().get("USER_INFO");
56 | if(oldPassword!=null && stu.getPassword()!=null && oldPassword.equals(stu.getPassword())==false){
57 | this.addFieldError("oldPassword", "老密码跟数据库中的不一致,请重新输入!");
58 | return;
59 | }
60 | if(newPassword==null || newPassword.trim().equals("")){
61 | this.addFieldError("newPassword", "新密码不能为空!");
62 | return;
63 | }
64 | if(newPassword2==null || newPassword2.trim().equals("")){
65 | this.addFieldError("newPassword2", "新密码不能为空!");
66 | return;
67 | }
68 | if(false == newPassword.equals(newPassword2)){
69 | this.addFieldError("newPassword2", "两次输入的新密码必须相同!");
70 | return;
71 | }
72 | }
73 |
74 | @Override
75 | public String execute() throws Exception {
76 | //所有action如果直接访问,未登录则进入main.jsp
77 | ActionContext ctx=ActionContext. getContext();
78 | logger.info("用户更改密码");
79 | if(ctx.getSession().containsKey("USER_INFO")==false){
80 | this.addActionError("您还没有登录,请登录后重新进入");
81 | return ERROR;
82 | }else{
83 | Student stu = (Student)ctx.getSession().get("USER_INFO");
84 | stu.setPassword(newPassword);
85 | studentDao.update(stu);
86 | this.addActionMessage("修改密码成功,请下次登录请使用新密码!");
87 | return SUCCESS;
88 | }
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/StudentExamScore.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import java.util.Date;
4 |
5 | import javax.persistence.CascadeType;
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 | import javax.persistence.JoinColumn;
11 | import javax.persistence.ManyToOne;
12 |
13 | @Entity
14 | public class StudentExamScore {
15 | @Id
16 | @GeneratedValue(strategy=GenerationType.IDENTITY)
17 | private int id;
18 | @ManyToOne(cascade=CascadeType.ALL)
19 | @JoinColumn(name="student_id")
20 | private Student student;
21 | @ManyToOne(cascade=CascadeType.ALL)
22 | @JoinColumn(name="exam_id")
23 | private Exam exam;
24 | @ManyToOne(cascade=CascadeType.ALL)
25 | @JoinColumn(name="exam_strategy_id")
26 | private ExamStrategy examStrategy;
27 | private int score;
28 | private String examPhase;
29 | private Date examStartTime;
30 | private Date examEndTime;
31 | private int timeUsed; //考试用时(单位:秒)
32 |
33 | public StudentExamScore() {}
34 |
35 | public StudentExamScore(Student student, Exam exam, ExamStrategy examStrategy, int score, String examPhase) {
36 | this.student = student;
37 | this.exam = exam;
38 | this.examStrategy = examStrategy;
39 | this.score = score;
40 | this.examPhase = examPhase;
41 | }
42 |
43 | public int getId() {
44 | return id;
45 | }
46 | public void setId(int id) {
47 | this.id = id;
48 | }
49 | public Student getStudent() {
50 | return student;
51 | }
52 | public void setStudent(Student student) {
53 | this.student = student;
54 | }
55 | public Exam getExam() {
56 | return exam;
57 | }
58 | public void setExam(Exam exam) {
59 | this.exam = exam;
60 | }
61 | public ExamStrategy getExamStrategy() {
62 | return examStrategy;
63 | }
64 |
65 | public void setExamStrategy(ExamStrategy examStrategy) {
66 | this.examStrategy = examStrategy;
67 | }
68 |
69 | public int getScore() {
70 | return score;
71 | }
72 | public void setScore(int score) {
73 | this.score = score;
74 | }
75 |
76 | public String getExamPhase() {
77 | return examPhase;
78 | }
79 |
80 | public Date getExamStartTime() {
81 | return examStartTime;
82 | }
83 |
84 | public void setExamStartTime(Date examStartTime) {
85 | this.examStartTime = examStartTime;
86 | }
87 |
88 | public Date getExamEndTime() {
89 | return examEndTime;
90 | }
91 |
92 | public void setExamEndTime(Date examEndTime) {
93 | this.examEndTime = examEndTime;
94 | }
95 |
96 | public void setExamPhase(String examPhase) {
97 | this.examPhase = examPhase;
98 | }
99 |
100 | public int getTimeUsed() {
101 | return timeUsed;
102 | }
103 |
104 | public void setTimeUsed(int timeUsed) {
105 | this.timeUsed = timeUsed;
106 | }
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/ExamScoreListAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import java.util.List;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.context.annotation.Scope;
10 | import org.springframework.stereotype.Component;
11 |
12 | import com.opensymphony.xwork2.ActionContext;
13 | import com.opensymphony.xwork2.ActionSupport;
14 |
15 | import cn.lynu.lyq.java_exam.common.ExamPhase;
16 | import cn.lynu.lyq.java_exam.dao.GradeDao;
17 | import cn.lynu.lyq.java_exam.dao.StudentExamScoreDao;
18 | import cn.lynu.lyq.java_exam.entity.Grade;
19 | import cn.lynu.lyq.java_exam.entity.StudentExamScore;
20 |
21 | @Component("examScoreList")
22 | @Scope("prototype")
23 | public class ExamScoreListAction extends ActionSupport {
24 |
25 | private static final long serialVersionUID = 4675761085855839420L;
26 | private final static Logger logger = LoggerFactory.getLogger(ExamScoreListAction.class);
27 | private String classSearch;
28 | private String examNameSearch;
29 |
30 | private List gradeList;
31 | private List examScoreList;
32 |
33 | @Resource
34 | private GradeDao gradeDao;
35 | @Resource
36 | private StudentExamScoreDao studentExamScoreDao;
37 |
38 | public String getClassSearch() {
39 | return classSearch;
40 | }
41 | public void setClassSearch(String classSearch) {
42 | this.classSearch = classSearch;
43 | }
44 | public String getExamNameSearch() {
45 | return examNameSearch;
46 | }
47 | public void setExamNameSearch(String examNameSearch) {
48 | this.examNameSearch = examNameSearch;
49 | }
50 | public List getGradeList() {
51 | return gradeList;
52 | }
53 | public void setGradeList(List gradeList) {
54 | this.gradeList = gradeList;
55 | }
56 | public List getExamScoreList() {
57 | return examScoreList;
58 | }
59 | public void setExamScoreList(List examScoreList) {
60 | this.examScoreList = examScoreList;
61 | }
62 |
63 | @Override
64 | public String execute() throws Exception {
65 | ActionContext ctx =ActionContext.getContext();
66 | if(ctx.getSession().containsKey("USER_INFO")){
67 | // Student stu=(Student)ctx.getSession().get("USER_INFO");
68 | gradeList = gradeDao.findAll();
69 | examScoreList = studentExamScoreDao.findByExamPhase(ExamPhase.FINAL_SCORED.getChineseName());
70 |
71 | return SUCCESS;
72 | }else{
73 | this.addActionError("您还没有登录,请登录后再点击进入");
74 | return ERROR;
75 | }
76 | }
77 |
78 | public String executeForSearch() throws Exception {
79 | gradeList = gradeDao.findAll();
80 | classSearch = classSearch!=null?classSearch:"";
81 | logger.info("按照搜索条件检索成绩");
82 | examScoreList = studentExamScoreDao.findByClassIdAndExamNameAndExamPhase(classSearch, examNameSearch, ExamPhase.FINAL_SCORED.getChineseName());
83 | return SUCCESS;
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/JudgeQuestionSearchAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import java.util.List;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.context.annotation.Scope;
10 | import org.springframework.stereotype.Component;
11 |
12 | import com.opensymphony.xwork2.ActionSupport;
13 |
14 | import cn.lynu.lyq.java_exam.dao.BankQuestionDao;
15 | import cn.lynu.lyq.java_exam.entity.BankJudgeQuestion;
16 |
17 | @Component("judgeQuestionSearch")
18 | @Scope("prototype")
19 | public class JudgeQuestionSearchAction extends ActionSupport{
20 | private static final long serialVersionUID = -1106576639902301220L;
21 | private final static Logger logger = LoggerFactory.getLogger(JudgeQuestionSearchAction.class);
22 |
23 | private String contentSearch;
24 | private String answerSearch;
25 | private String knowledgeSearch;
26 | private List questionList;
27 | private int totalPage;
28 | private int pageIndex;
29 | private static final int PAGE_SIZE = 10;
30 | @Resource
31 | private BankQuestionDao bankQuestionDao;
32 |
33 | public String getContentSearch() {
34 | return contentSearch;
35 | }
36 | public void setContentSearch(String contentSearch) {
37 | this.contentSearch = contentSearch;
38 | }
39 | public String getAnswerSearch() {
40 | return answerSearch;
41 | }
42 | public void setAnswerSearch(String answerSearch) {
43 | this.answerSearch = answerSearch;
44 | }
45 | public String getKnowledgeSearch() {
46 | return knowledgeSearch;
47 | }
48 | public void setKnowledgeSearch(String knowledgeSearch) {
49 | this.knowledgeSearch = knowledgeSearch;
50 | }
51 | public List getQuestionList() {
52 | return questionList;
53 | }
54 | public void setQuestionList(List questionList) {
55 | this.questionList = questionList;
56 | }
57 | public int getTotalPage() {
58 | return totalPage;
59 | }
60 | public void setTotalPage(int totalPage) {
61 | this.totalPage = totalPage;
62 | }
63 | public int getPageIndex() {
64 | return pageIndex;
65 | }
66 | public void setPageIndex(int pageIndex) {
67 | this.pageIndex = pageIndex;
68 | }
69 | @Override
70 | public String execute() throws Exception {//初始结果
71 | // questionList = bankQuestionDao.findAllJudge();
72 | int totalCnt = bankQuestionDao.countAllJudge();
73 | totalPage = (totalCnt%PAGE_SIZE > 0)?(totalCnt/PAGE_SIZE+1):(totalCnt/PAGE_SIZE);
74 | questionList = bankQuestionDao.findAllJudgeWithPage(pageIndex,PAGE_SIZE);
75 | return SUCCESS;
76 | }
77 |
78 | public String executeForSearch(){//搜索后结果
79 | logger.debug("contentSearch="+contentSearch);
80 | logger.debug("answerSearch="+answerSearch);
81 | logger.debug("knowledgeSearch="+knowledgeSearch);
82 | questionList = bankQuestionDao.findJudgeForSearch(contentSearch,answerSearch,knowledgeSearch);
83 | return SUCCESS;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/BlankQuestionSearchAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import java.util.List;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.context.annotation.Scope;
10 | import org.springframework.stereotype.Component;
11 |
12 | import com.opensymphony.xwork2.ActionSupport;
13 |
14 | import cn.lynu.lyq.java_exam.dao.BankQuestionDao;
15 | import cn.lynu.lyq.java_exam.entity.BankBlankFillingQuestion;
16 |
17 | @Component("blankQuestionSearch")
18 | @Scope("prototype")
19 | public class BlankQuestionSearchAction extends ActionSupport{
20 | private static final long serialVersionUID = -1106576639902301220L;
21 | private final static Logger logger = LoggerFactory.getLogger(BlankQuestionSearchAction.class);
22 | private String contentSearch;
23 | private String answerSearch;
24 | private String knowledgeSearch;
25 | private List questionList;
26 | private int totalPage;
27 | private int pageIndex;
28 | private static final int PAGE_SIZE = 10;
29 |
30 | @Resource
31 | private BankQuestionDao bankQuestionDao;
32 |
33 | public String getContentSearch() {
34 | return contentSearch;
35 | }
36 | public void setContentSearch(String contentSearch) {
37 | this.contentSearch = contentSearch;
38 | }
39 | public String getAnswerSearch() {
40 | return answerSearch;
41 | }
42 | public void setAnswerSearch(String answerSearch) {
43 | this.answerSearch = answerSearch;
44 | }
45 | public String getKnowledgeSearch() {
46 | return knowledgeSearch;
47 | }
48 | public void setKnowledgeSearch(String knowledgeSearch) {
49 | this.knowledgeSearch = knowledgeSearch;
50 | }
51 | public List getQuestionList() {
52 | return questionList;
53 | }
54 | public void setQuestionList(List questionList) {
55 | this.questionList = questionList;
56 | }
57 | public int getTotalPage() {
58 | return totalPage;
59 | }
60 | public void setTotalPage(int totalPage) {
61 | this.totalPage = totalPage;
62 | }
63 | public int getPageIndex() {
64 | return pageIndex;
65 | }
66 | public void setPageIndex(int pageIndex) {
67 | this.pageIndex = pageIndex;
68 | }
69 | @Override
70 | public String execute() throws Exception {//初始结果
71 | // questionList = bankQuestionDao.findAllBlankFilling();
72 | int totalCnt = bankQuestionDao.countAllBlankFilling();
73 | totalPage = (totalCnt%PAGE_SIZE > 0)?(totalCnt/PAGE_SIZE+1):(totalCnt/PAGE_SIZE);
74 | questionList = bankQuestionDao.findAllBlankFillingWithPage(pageIndex,PAGE_SIZE);
75 | return SUCCESS;
76 | }
77 |
78 | public String executeForSearch(){//搜索后结果
79 | logger.debug("contentSearch="+contentSearch);
80 | logger.debug("answerSearch="+answerSearch);
81 | logger.debug("knowledgeSearch="+knowledgeSearch);
82 | questionList = bankQuestionDao.findBlankForSearch(contentSearch,answerSearch,knowledgeSearch);
83 | return SUCCESS;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/webapp/questionByKnowledge.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ taglib uri="/struts-tags" prefix="s"%>
4 |
5 |
6 |
7 |
8 | Java考试系统--按知识点查看题目
9 |
10 |
11 |
12 |
13 |
14 |
22 |
23 |
24 | <%@ include file="include/header.jsp"%>
25 |
26 |
27 |
28 |
29 |
30 | - Java程序设计
31 |
32 | - 编程基础
(面向过程)
33 |
34 | - 标识符与注释
35 | - 基本数据类型
36 | - 流程控制
37 |
38 | - 选择结构
39 |
40 | - if...else语句
41 | - switch...case语句
42 |
43 |
44 | - 循环结构
45 |
46 | - while循环
47 | - do...while循环
48 | - for循环
49 |
50 |
51 |
52 |
53 |
54 |
55 | - 面向对象
56 |
57 | - 封装
58 |
59 | - 成员变量与成员方法
60 | - this关键字
61 |
62 |
63 | - 继承
64 |
65 | - super关键字
66 | - 方法的重写
67 | - final关键字
68 |
69 |
70 | - 多态
71 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | <%@ include file="include/footer.jsp"%>
86 |
87 |
88 |
89 |
90 |
91 |
105 |
106 |
--------------------------------------------------------------------------------
/src/main/webapp/choiceDetail.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 |
4 |
5 |
6 |
7 | Java考试系统--选择题详细
8 |
9 |
10 |
11 |
12 |
47 |
48 |
49 | <%@ include file="include/header.jsp" %>
50 |
51 |
52 |
53 | |
54 |
58 | |
59 |
60 |
61 | |
62 |
63 |
64 |
65 |
66 | | A. | |
67 | | B. | |
68 | | C. | |
69 | | D. | |
70 |
71 | |
72 |
73 |
74 | |
75 | 答案:
76 | |
77 |
78 |
79 |
80 | |
81 |
85 | |
86 |
87 |
88 |
89 |
90 |
91 | <%@ include file="include/footer.jsp" %>
92 |
93 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/ExamQuestion.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import javax.persistence.CascadeType;
4 | import javax.persistence.Entity;
5 | import javax.persistence.GeneratedValue;
6 | import javax.persistence.GenerationType;
7 | import javax.persistence.Id;
8 | import javax.persistence.JoinColumn;
9 | import javax.persistence.ManyToOne;
10 |
11 | import cn.lynu.lyq.java_exam.common.QuestionType;
12 |
13 | @Entity
14 | public class ExamQuestion {
15 | @Id
16 | @GeneratedValue(strategy=GenerationType.IDENTITY)
17 | private int id;
18 |
19 | @ManyToOne(cascade=CascadeType.ALL)
20 | @JoinColumn(name="exam_id")
21 | private Exam exam;
22 |
23 | @ManyToOne(cascade=CascadeType.ALL)
24 | @JoinColumn(name="bank_choice_qid")
25 | private BankChoiceQuestion bankChoiceQuestion;
26 |
27 | @ManyToOne(cascade=CascadeType.ALL)
28 | @JoinColumn(name="bank_blankfilling_qid")
29 | private BankBlankFillingQuestion bankBlankFillingQuestion;
30 |
31 | @ManyToOne(cascade=CascadeType.ALL)
32 | @JoinColumn(name="bank_judge_qid")
33 | private BankJudgeQuestion bankJudgeQuestion;
34 |
35 | private int questionType;
36 |
37 | public ExamQuestion(){}
38 |
39 | public ExamQuestion(Exam exam, BankChoiceQuestion bankChoiceQuestion) {
40 | this.exam = exam;
41 | this.bankChoiceQuestion = bankChoiceQuestion;
42 | this.questionType = QuestionType.CHOICE.ordinal();
43 | }
44 | public ExamQuestion(Exam exam, BankBlankFillingQuestion bankBlankFillingQuestion) {
45 | this.exam = exam;
46 | this.bankBlankFillingQuestion = bankBlankFillingQuestion;
47 | this.questionType = QuestionType.BLANK_FILLING.ordinal();
48 | }
49 | public ExamQuestion(Exam exam, BankJudgeQuestion bankJudgeQuestion) {
50 | this.exam = exam;
51 | this.bankJudgeQuestion = bankJudgeQuestion;
52 | this.questionType = QuestionType.JUDGE.ordinal();
53 | }
54 |
55 | public int getId() {
56 | return id;
57 | }
58 |
59 | public void setId(int id) {
60 | this.id = id;
61 | }
62 |
63 | public Exam getExam() {
64 | return exam;
65 | }
66 |
67 | public void setExam(Exam exam) {
68 | this.exam = exam;
69 | }
70 |
71 | public BankChoiceQuestion getBankChoiceQuestion() {
72 | return bankChoiceQuestion;
73 | }
74 |
75 | public void setBankChoiceQuestion(BankChoiceQuestion bankChoiceQuestion) {
76 | this.bankChoiceQuestion = bankChoiceQuestion;
77 | }
78 |
79 | public BankBlankFillingQuestion getBankBlankFillingQuestion() {
80 | return bankBlankFillingQuestion;
81 | }
82 |
83 | public void setBankBlankFillingQuestion(BankBlankFillingQuestion bankBlankFillingQuestion) {
84 | this.bankBlankFillingQuestion = bankBlankFillingQuestion;
85 | }
86 |
87 | public BankJudgeQuestion getBankJudgeQuestion() {
88 | return bankJudgeQuestion;
89 | }
90 |
91 | public void setBankJudgeQuestion(BankJudgeQuestion bankJudgeQuestion) {
92 | this.bankJudgeQuestion = bankJudgeQuestion;
93 | }
94 |
95 | public int getQuestionType() {
96 | return questionType;
97 | }
98 |
99 | public void setQuestionType(int questionType) {
100 | this.questionType = questionType;
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/BankBlankFillingQuestion.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import javax.persistence.Entity;
4 |
5 | /*
6 | * 填空题题库
7 | * 答案(该属性在父类里):只有一个空则直接用answer属性表示
8 | * 多个空的答案分别用answer2~answer8表示
9 | */
10 | @Entity
11 | public class BankBlankFillingQuestion extends BankQuestion {
12 | private String answer2;
13 | private String answer3;
14 | private String answer4;
15 | private String answer5;
16 | private String answer6;
17 | private String answer7;
18 | private String answer8;
19 |
20 | public BankBlankFillingQuestion(){}
21 |
22 | public BankBlankFillingQuestion(String content,String answer,String knowledgePoint) {
23 | setContent(content);
24 | setAnswer(answer);
25 | setKnowledgePoint(knowledgePoint);
26 | setComposeFlag(1); //默认允许题目参与随机抽题
27 | }
28 |
29 | public BankBlankFillingQuestion(String content,String answer, String answer2,String knowledgePoint) {
30 | setContent(content);
31 | setAnswer(answer);
32 | this.answer2 = answer2;
33 | setKnowledgePoint(knowledgePoint);
34 | setComposeFlag(1); //默认允许题目参与随机抽题
35 | }
36 |
37 | public BankBlankFillingQuestion(String content,String answer, String answer2, String answer3,String knowledgePoint) {
38 | setContent(content);
39 | setAnswer(answer);
40 | this.answer2 = answer2;
41 | this.answer3 = answer3;
42 | setKnowledgePoint(knowledgePoint);
43 | setComposeFlag(1); //默认允许题目参与随机抽题
44 | }
45 |
46 | public BankBlankFillingQuestion(String content,String answer, String answer2, String answer3, String answer4,String knowledgePoint) {
47 | setContent(content);
48 | setAnswer(answer);
49 | this.answer2 = answer2;
50 | this.answer3 = answer3;
51 | this.answer4 = answer4;
52 | setKnowledgePoint(knowledgePoint);
53 | setComposeFlag(1); //默认允许题目参与随机抽题
54 | }
55 |
56 | public String getAnswer2() {
57 | return answer2;
58 | }
59 |
60 | public void setAnswer2(String answer2) {
61 | this.answer2 = answer2;
62 | }
63 |
64 | public String getAnswer3() {
65 | return answer3;
66 | }
67 |
68 | public void setAnswer3(String answer3) {
69 | this.answer3 = answer3;
70 | }
71 |
72 | public String getAnswer4() {
73 | return answer4;
74 | }
75 |
76 | public void setAnswer4(String answer4) {
77 | this.answer4 = answer4;
78 | }
79 |
80 | public String getAnswer5() {
81 | return answer5;
82 | }
83 |
84 | public void setAnswer5(String answer5) {
85 | this.answer5 = answer5;
86 | }
87 |
88 | public String getAnswer6() {
89 | return answer6;
90 | }
91 |
92 | public void setAnswer6(String answer6) {
93 | this.answer6 = answer6;
94 | }
95 |
96 | public String getAnswer7() {
97 | return answer7;
98 | }
99 |
100 | public void setAnswer7(String answer7) {
101 | this.answer7 = answer7;
102 | }
103 |
104 | public String getAnswer8() {
105 | return answer8;
106 | }
107 |
108 | public void setAnswer8(String answer8) {
109 | this.answer8 = answer8;
110 | }
111 |
112 | @Override
113 | public String toString() {
114 | return String.valueOf(getId());
115 | // return "填空题 [题目:" + getContent()
116 | // + ", 答案:" + getAnswer()
117 | // + "答案2=" + answer2 + "]";
118 | }
119 |
120 |
121 |
122 | }
123 |
--------------------------------------------------------------------------------
/src/main/webapp/examComposeTypes.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ taglib uri="/struts-tags" prefix="s"%>
4 |
5 |
6 |
7 |
8 | Java考试系统--抽题组卷类型
9 |
10 |
11 |
12 |
13 |
14 |
28 |
29 |
30 | <%@ include file="include/header.jsp" %>
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
">

41 |
42 |
43 |
">
44 |
固定组卷
45 |
46 |
">固定组卷
47 |
48 |
49 |
50 |
51 |
52 |
53 |
55 |
">

56 |
57 |
58 |
">
59 |
随机抽题组卷
60 |
61 |
">随机抽题组卷
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | <%@ include file="include/footer.jsp"%>
71 |
72 |
73 |
74 |
93 |
94 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/entity/BankChoiceQuestion.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.entity;
2 |
3 | import javax.persistence.Entity;
4 |
5 | /*
6 | * 选择题题库(包含单选和多选题)
7 | * 答案(该属性在父类里):单选则用A,B,C,D表示
8 | * 多选用[A,B,...]表示
9 | */
10 | @Entity
11 | public class BankChoiceQuestion extends BankQuestion {
12 | private String choiceA;
13 | private String choiceB;
14 | private String choiceC;
15 | private String choiceD;
16 | private String choiceE;
17 | private String choiceF;
18 | private String choiceG;
19 | private String choiceH;
20 |
21 | public BankChoiceQuestion(){}
22 |
23 | public BankChoiceQuestion(String content,String choiceA, String choiceB, String choiceC, String choiceD,String answer,String knowledgePoint) {
24 | setContent(content);
25 | this.choiceA = choiceA;
26 | this.choiceB = choiceB;
27 | this.choiceC = choiceC;
28 | this.choiceD = choiceD;
29 | setAnswer(answer);
30 | setKnowledgePoint(knowledgePoint);
31 | setComposeFlag(1); //默认允许题目参与随机抽题
32 | }
33 |
34 | public BankChoiceQuestion(String content,String choiceA, String choiceB, String choiceC, String choiceD,
35 | String choiceE, String choiceF, String choiceG, String choiceH, String answer,String knowledgePoint) {
36 | setContent(content);
37 | this.choiceA = choiceA;
38 | this.choiceB = choiceB;
39 | this.choiceC = choiceC;
40 | this.choiceD = choiceD;
41 | this.choiceE = choiceE;
42 | this.choiceF = choiceF;
43 | this.choiceG = choiceG;
44 | this.choiceH = choiceH;
45 | setAnswer(answer);
46 | setKnowledgePoint(knowledgePoint);
47 | setComposeFlag(1); //默认允许题目参与随机抽题
48 | }
49 | public String getChoiceA() {
50 | return choiceA;
51 | }
52 |
53 | public void setChoiceA(String choiceA) {
54 | this.choiceA = choiceA;
55 | }
56 |
57 | public String getChoiceB() {
58 | return choiceB;
59 | }
60 |
61 | public void setChoiceB(String choiceB) {
62 | this.choiceB = choiceB;
63 | }
64 |
65 | public String getChoiceC() {
66 | return choiceC;
67 | }
68 |
69 | public void setChoiceC(String choiceC) {
70 | this.choiceC = choiceC;
71 | }
72 |
73 | public String getChoiceD() {
74 | return choiceD;
75 | }
76 |
77 | public void setChoiceD(String choiceD) {
78 | this.choiceD = choiceD;
79 | }
80 |
81 | public String getChoiceE() {
82 | return choiceE;
83 | }
84 |
85 | public void setChoiceE(String choiceE) {
86 | this.choiceE = choiceE;
87 | }
88 |
89 | public String getChoiceF() {
90 | return choiceF;
91 | }
92 |
93 | public void setChoiceF(String choiceF) {
94 | this.choiceF = choiceF;
95 | }
96 |
97 | public String getChoiceG() {
98 | return choiceG;
99 | }
100 |
101 | public void setChoiceG(String choiceG) {
102 | this.choiceG = choiceG;
103 | }
104 |
105 | public String getChoiceH() {
106 | return choiceH;
107 | }
108 |
109 | public void setChoiceH(String choiceH) {
110 | this.choiceH = choiceH;
111 | }
112 |
113 | @Override
114 | public String toString() {
115 | return String.valueOf(getId());
116 | // return "选择题 ["+ ", 题目:" + getContent()
117 | // + ", 答案:" + getAnswer()
118 | // + ", 选项A:" + choiceA
119 | // + ", 选项B:" + choiceB
120 | // + ", 选项C:" + choiceC
121 | // + ", 选项D:" + choiceD + "]";
122 | }
123 |
124 |
125 |
126 | }
127 |
--------------------------------------------------------------------------------
/src/main/webapp/examSummary.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ taglib uri="/struts-tags" prefix="s" %>
4 |
5 |
6 |
7 |
8 |
9 | Java考试系统--试卷提交概览
10 |
11 |
12 |
13 |
14 |
24 |
31 |
32 |
33 | <%@ include file="include/header.jsp" %>
34 |
35 |
74 |
75 |
76 |
77 | <%@ include file="include/footer.jsp" %>
78 |
79 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/impl/ExamQuestionAnswerDaoImpl.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao.impl;
2 |
3 | import java.util.List;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.hibernate.Query;
8 | import org.hibernate.SessionFactory;
9 | import org.slf4j.Logger;
10 | import org.slf4j.LoggerFactory;
11 | import org.springframework.stereotype.Component;
12 | import org.springframework.transaction.annotation.Propagation;
13 | import org.springframework.transaction.annotation.Transactional;
14 |
15 | import cn.lynu.lyq.java_exam.dao.ExamQuestionAnswerDao;
16 | import cn.lynu.lyq.java_exam.entity.Exam;
17 | import cn.lynu.lyq.java_exam.entity.ExamQuestion;
18 | import cn.lynu.lyq.java_exam.entity.ExamQuestionAnswer;
19 | import cn.lynu.lyq.java_exam.entity.Student;
20 | @Component("examQuestionAnswerDao")
21 | @Transactional
22 | public class ExamQuestionAnswerDaoImpl implements ExamQuestionAnswerDao {
23 | private final static Logger logger = LoggerFactory.getLogger(ExamQuestionAnswerDaoImpl.class);
24 | @Resource
25 | private SessionFactory sessionFactory;
26 |
27 | public void setSessionFactory(SessionFactory sessionFactory) {
28 | this.sessionFactory = sessionFactory;
29 | }
30 |
31 | @Override
32 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
33 | public ExamQuestionAnswer findById(int id) {
34 | ExamQuestionAnswer eqa = sessionFactory.getCurrentSession().get(ExamQuestionAnswer.class, id);
35 | return eqa;
36 | }
37 |
38 | @SuppressWarnings("unchecked")
39 | @Override
40 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
41 | public List findAll(){
42 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamQuestionAnswer");
43 | return q.list();
44 | }
45 |
46 | @SuppressWarnings("unchecked")
47 | @Override
48 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
49 | public List findByExamQuestion(ExamQuestion eq){
50 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamQuestionAnswer where examQuestion=?0");
51 | q.setParameter("0", eq);
52 | return q.list();
53 | }
54 |
55 | @Override
56 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
57 | public ExamQuestionAnswer findByStudentAndExamQuestion(Student student, ExamQuestion examQuestion){
58 | logger.debug("student="+student);
59 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamQuestionAnswer where student=?0 and examQuestion=?1");
60 | q.setParameter("0", student);
61 | q.setParameter("1", examQuestion);
62 | return (ExamQuestionAnswer)q.uniqueResult();
63 | }
64 |
65 | @SuppressWarnings("unchecked")
66 | @Override
67 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
68 | public List findByStudentAndExam(Exam exam,Student student){
69 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamQuestionAnswer eqa where eqa.student=?0 and eqa.examQuestion.exam=?1");
70 | q.setParameter("0", student);
71 | q.setParameter("1", exam);
72 | return q.list();
73 | }
74 |
75 | @Override
76 | public void save(ExamQuestionAnswer eqa){
77 | sessionFactory.getCurrentSession().save(eqa);
78 | }
79 |
80 | @Override
81 | public void update(ExamQuestionAnswer eqa){
82 | sessionFactory.getCurrentSession().update(eqa);
83 | }
84 |
85 | @Override
86 | public void delete(ExamQuestionAnswer eqa){
87 | sessionFactory.getCurrentSession().delete(eqa);
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/actions/ScoreStatsAction.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.actions;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import javax.annotation.Resource;
7 |
8 | import org.slf4j.Logger;
9 | import org.slf4j.LoggerFactory;
10 | import org.springframework.context.annotation.Scope;
11 | import org.springframework.stereotype.Component;
12 |
13 | import com.opensymphony.xwork2.ActionContext;
14 | import com.opensymphony.xwork2.ActionSupport;
15 |
16 | import cn.lynu.lyq.java_exam.dao.ExamDao;
17 | import cn.lynu.lyq.java_exam.dao.GradeDao;
18 | import cn.lynu.lyq.java_exam.dao.StudentExamScoreDao;
19 | import cn.lynu.lyq.java_exam.entity.Grade;
20 | import cn.lynu.lyq.java_exam.entity.Student;
21 |
22 | @Component("scoreStats")
23 | @Scope("prototype")
24 | public class ScoreStatsAction extends ActionSupport {
25 | private static final long serialVersionUID = -1980837224909869714L;
26 | private final static Logger logger = LoggerFactory.getLogger(ScoreStatsAction.class);
27 |
28 | @Resource
29 | private GradeDao gradeDao;
30 | @Resource
31 | private ExamDao examDao;
32 | @Resource
33 | private StudentExamScoreDao studentExamScoreDao;
34 |
35 | private List gradeList = new ArrayList<>();
36 | private List examNameList = new ArrayList<>();
37 | private String classSearch;
38 | private String examNameSearch;
39 | private List examAbsentStudentList=new ArrayList<>();
40 |
41 | public List getGradeList() {
42 | return gradeList;
43 | }
44 | public void setGradeList(List gradeList) {
45 | this.gradeList = gradeList;
46 | }
47 | public List getExamNameList() {
48 | return examNameList;
49 | }
50 | public void setExamNameList(List examNameList) {
51 | this.examNameList = examNameList;
52 | }
53 | public String getClassSearch() {
54 | return classSearch;
55 | }
56 | public void setClassSearch(String classSearch) {
57 | this.classSearch = classSearch;
58 | }
59 | public String getExamNameSearch() {
60 | return examNameSearch;
61 | }
62 | public void setExamNameSearch(String examNameSearch) {
63 | this.examNameSearch = examNameSearch;
64 | }
65 | public List getExamAbsentStudentList() {
66 | return examAbsentStudentList;
67 | }
68 | public void setExamAbsentStudentList(List examAbsentStudentList) {
69 | this.examAbsentStudentList = examAbsentStudentList;
70 | }
71 |
72 | @Override
73 | public String execute() throws Exception {
74 | ActionContext ctx =ActionContext.getContext();
75 | if(ctx.getSession().containsKey("USER_INFO")){
76 | gradeList = gradeDao.findAll();
77 | examNameList = examDao.findAllDistinctExamName();
78 | return SUCCESS;
79 | }else{
80 | this.addActionError("您还没有登录,请登录后再点击进入");
81 | return ERROR;
82 | }
83 | }
84 |
85 | public String executeForSearch() throws Exception {
86 | gradeList = gradeDao.findAll();
87 | examNameList = examDao.findAllDistinctExamName();
88 |
89 | classSearch = classSearch!=null?classSearch:"";
90 | examNameSearch = examNameSearch!=null?examNameSearch:"";
91 |
92 | logger.info("统计缺考考生");
93 | //只有一个班级和一个考试名称选中时,返回缺考考生
94 | if(!classSearch.equals("") && !classSearch.contains(",") && !examNameSearch.equals("")){
95 | examAbsentStudentList = studentExamScoreDao.getAbsentStudentsForExamName(classSearch,examNameList.get(Integer.parseInt(examNameSearch)-1));
96 | }
97 | return SUCCESS;
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/src/main/webapp/other/填空题_import_20170404.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应至少以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节或知识点
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示填空题题干描述,可以为多行
5 | ######题干中用下划线表示填空的位置。
6 |
7 | ###### 注意,题干的第二行开始开头不能再用字母或数字(因已经被题干的首字符占用)
8 | ######题干结束后的一行,以三个>号开头(">>>")表示答案,多个答案用空格分割;
9 |
10 | #######在有可能引起歧义的情况下(例如答案中本身含有逗号),题干可采用第二种形式,
11 | #######即在题干中包含答案,答案用<<<和>>>包围,此时不应有专门的答案行。
12 | ######所有题结束后最后一行应至少以6个#号开头("######"),后续不能有空行!
13 |
14 | ######
15 | ***Java语言基础***
16 | 1. Java的三大平台分别是Java SE、_________________和Java ME。
17 | >>>Java EE
18 | ######
19 | ***Java语言基础***
20 | 2. Java程序开发前需下载安装Java应用程序开发包,其英文缩写是__________。
21 | >>>JDK
22 | ######
23 | ***Java语言基础***
24 | 3, 在Windows下打开命令行界面的方法是搜索输入命令_________________。
25 | >>>CMD
26 | ######
27 | ***Java语言基础***
28 | 4, JDK安装完成后,javac和java这些编译和运行工具存放在JDK安装目录
29 | 的_____________子目录中。
30 | >>>bin
31 | ######
32 | ***Java语言基础***
33 | 5, JDK安装完成后,在操作系统上还需要配置_______________环境变量,
34 | 该环境变量用于存储Java的编译和运行工具所在的路径。
35 | >>>Path
36 | ######
37 | ***Java语言基础***
38 | 6, Java中的________________用于为程序增加一些说明性文字,增加程序的可读性,
39 | 本身不会被执行。
40 | >>>注释
41 | ######
42 | ***Java语言基础***
43 | 7, Java中单行注释是在注释前书写______________符号。
44 | >>>//
45 | ######
46 | ***Java语言基础***
47 | 8, Java中有三种注释,分别是单行注释、多行注释和_________________。
48 | >>>文档注释
49 | ######
50 | ***Java语言基础***
51 | 9, Java程序从________________方法开始执行。
52 | >>>main()
53 | ######
54 | ***Java语言基础***
55 | 10, Java是一种___________________编程语言,它要求所有变量都具有一个类型。
56 | >>>强类型
57 | ######
58 | ***Java语言基础***
59 | 11, Java数据类型分为两大类,分别是基本数据类型和____________________。
60 | >>>引用数据类型
61 | ######
62 | ***Java语言基础***
63 | 12, Java中的int类型占用______________个字节。
64 | >>>4
65 | ######
66 | ***Java语言基础***
67 | 13, Java中的整型数的字面值在表示八进制时,需添加前缀________________。
68 | >>>0
69 | ######
70 | ***Java语言基础***
71 | 14, Java中都整型数的字面值在表示十六进制时,需添加前缀_______________。
72 | >>>0x
73 | ######
74 | ***Java语言基础***
75 | 15, Java中在整数后面添加后缀字母______________表示long型整数。
76 | >>>L
77 | ######
78 | ***Java语言基础***
79 | 16, Java的基本数据类型中,float和____________________类型用于保存浮点数。
80 | >>>double
81 | ######
82 | ***Java语言基础***
83 | 17, float类型的字面值在书写时浮点数时,还需要在最后添加后缀字母_____________。
84 | >>>f
85 | ######
86 | ***Java语言基础***
87 | 18, Java的基本类型中,_______________类型表示字符型。
88 | >>>char
89 | ######
90 | ***Java语言基础***
91 | 19, Java中的赋值运算符是______________。
92 | >>>=
93 | ######
94 | ***Java语言基础***
95 | 20, Java的boolean类型只有_______________和false两个取值。
96 | >>>true
97 | ######
98 | ***Java语言基础***
99 | 21, 依据结构化程序设计理论,所有程序都可以用三种基本控制结构构成,
100 | 它们分别是顺序、选择和________________。
101 | >>>循环
102 | ######
103 | ***Java语言基础***
104 | 22, Java中的_________________语句用于在条件为true时执行一些语句,
105 | 而条件为false时执行另一些语句。。
106 | >>>if-else
107 | ######
108 | ***Java语言基础***
109 | 23, Java中的for语句中小括号里有3部分,它们之间用______________分隔。
110 | (用汉字回答)
111 | >>>分号
112 | ######
113 | ***Java语言基础***
114 | 24, Java中的________________语句用于根据一个整型数或表达式的值,
115 | 从多路分支中选择其中一路执行。。
116 | >>>switch
117 | ######
118 | ***Java语言基础***
119 | 25, 在Java的三种循环语句for循环、while循环、do-while循环中,
120 | ______________循环会在执行循环体之后判断测试条件,因此至少会执行一遍循环体。
121 | >>>do-while
122 | ######
123 | ***Java语言基础***
124 | 26, Java语言在执行循环的过程中,遇到________________语句,
125 | 会跳过循环体中剩下的语句,继续进行下一次循环。
126 | >>>continue
127 | ######
128 | ***Java语言基础***
129 | 27, 在Java的方法声明中,________________关键字表示该方法没有返回值。
130 | >>>void
131 | ######
132 | ***Java语言基础***
133 | 28, Java的数组属于___________________数据类型。
134 | >>>引用
135 | ######
136 | ***Java语言基础***
137 | 29, Java中取得数组的长度,可以使用用数组变量的_______________属性。
138 | >>>length
139 | ######
140 | ***Java语言基础***
141 | 30, Java中包含10个元素的数组,其下标的范围是___________________。
142 | >>>从0到9
143 | ######
--------------------------------------------------------------------------------
/src/main/webapp/other/选择题_import_20170404.txt:
--------------------------------------------------------------------------------
1 | ######格式说明:(文件需要以UTF-8格式编码,推荐notepad++编辑和转换编码)
2 | ######每道题第一行应以6个#号开头("######"),
3 | ######第二行用3个*号开头("***")表示该题所属章节
4 | ######第三行开始用数字开头(数字表示题号,是多少无所谓)表示选择题题干描述,可以为多行
5 | ######以A. B. C. D. E. ...这些字母开头的行表示选项,每个选项可以为多行,但行之间不能有空行; 每题最多8个选项(A~H)
6 | ###### 注意,每个选项的第二行不能再用字母或数字(因已经被选项、题干占用)
7 | ######选项行结束后的一行,以三个>号开头(">>>")表示答案,多选题答案用逗号隔开,如A,B,C
8 | ######所有题结束后最后一行应以6个#号开头("######"),后续不能有空行!
9 | ######
10 | ***Java语言基础***
11 | 1,如果JDK的安装路径是"d:\jdk",若想在命令行窗口中任何路径下,都可以直接使用javac和java命令,
12 | 需要将环境变量Path设置为以下哪个选项:( )
13 | A. d:\jdk
14 | B. d:\jdk\bin
15 | C. d:\jre\bin
16 | D. d:\jre
17 | >>>B
18 | ######
19 | ***Java语言基础***
20 | 2,下面以哪种类型的文件可以直接在Java虚拟机中运行:( )。
21 | A..java
22 | B..jre
23 | C..exe
24 | D..class
25 | >>>D
26 | ######
27 | ***Java语言基础***
28 | 3,下面哪个是合法的Java标识符:( )
29 | A.void
30 | B.12class
31 | C._blank
32 | D.95
33 | >>>C
34 | ######
35 | ***Java语言基础***
36 | 4,Java中类的定义必须包含在一下哪种符号之间?( )
37 | A. 方括号[ ]
38 | B. 花括号{ }
39 | C. 双引号" "
40 | D. 圆括号( )
41 | >>>B
42 | ######
43 | ***Java语言基础***
44 | 5,Java的运算符中用于执行除法运算的是哪个?( )
45 | A. /
46 | B. \
47 | C. %
48 | D. *
49 | >>>A
50 | ######
51 | ***Java语言基础***
52 | 6,以下哪个关键字不是用于循环语句的?( )
53 | A. for
54 | B. do...while
55 | C. while
56 | D. switch
57 | >>>D
58 | ######
59 | ***Java语言基础***
60 | 7,以下哪种写法可以实现访问数组array的最开始的第一个元素?( )
61 | A. array[0]
62 | B. array(0)
63 | C. array[1]
64 | D. array(1)
65 | >>>A
66 | ######
67 | ***Java语言基础***
68 | 8,如下哪个选项可以正确地创建一个长度为3的二维数组?( )
69 | A. new int[2][3]
70 | B. new int[3][ ]
71 | C. new int[ ][3]
72 | D. 以上都不对
73 | >>>B
74 | ######
75 | ***Java语言基础***
76 | 9,当编译和运行下列代码会发生什么?( )
77 | [[[program009.png]]]
78 | A. 编译错误
79 | B. 运行错误
80 | C. 输出888
81 | D. 输出125
82 | >>>A
83 | ######
84 | ***Java语言基础***
85 | 10,下列选项中,哪个不属于Java语言的基本数据类型?( )
86 | A. 整型
87 | B. 数组
88 | C. 字符型
89 | D. 浮点型
90 | >>>B
91 | ######
92 | ***Java语言基础***
93 | 11,有关方法重载,以下说法正确的是:( )
94 | A. 重载的方法,其方法名可以不一致
95 | B. 重载的方法参数的个数或类型必须不一致
96 | C. 重载的方法,其返回值类型必须不同
97 | D. 重载的方法,其参数个数必须一致
98 | >>>B
99 | ######
100 | ***Java语言基础***
101 | 12,下列关于Java语言简单数据类型的说法中,正确的一项是:( )
102 | A. 以0开头的整数数值代表8进制整型数
103 | B. 以0x或0X开头的整数代表8进制整型常量
104 | C. char型的值可以包含一个或多个字符
105 | D. double类型的数据占计算机存储的32位
106 | >>>A
107 | ######
108 | ***Java语言基础***
109 | 13,下列语句中编译错误的一个是:( )
110 | A. float f = 1.1f;
111 | B. byte b = 128;
112 | C. double d = 1.1/0.0;
113 | D. char c = (char)1.1f;
114 | >>>B
115 | ######
116 | ***Java语言基础***
117 | 14,表达式(12==0) && (1/0 < 1)的值为:( )
118 | A. true
119 | B. false
120 | C. 0
121 | D. 运行时抛出异常
122 | >>>B
123 | ######
124 | ***Java语言基础***
125 | 15,表达式10^2的值为:( )
126 | A. 100
127 | B. 12
128 | C. 8
129 | D. 10
130 | >>>C
131 | ######
132 | ***Java语言基础***
133 | 16,假设i=10, j=20, k=30,则表达式 !(i>>B
139 | ######
140 | ***Java语言基础***
141 | 17,以下代码的运行结果是:( )
142 | [[[program017.png]]]
143 | A. 1
144 | B. 2
145 | C. 3
146 | D. 以上都不对
147 | >>>A
148 | ######
149 | ***Java语言基础***
150 | 18,分析以下代码,正确的选项是:( )
151 | [[[program018.png]]]
152 | A. 打印b=3
153 | B. 打印b=7
154 | C. 编译错误
155 | D. 以上都不对
156 | >>>C
157 | ######
158 | ***Java语言基础***
159 | 19,分析以下代码,正确的选项是:( )
160 | [[[program019.png]]]
161 | A. 打印3
162 | B. 打印6
163 | C. 编译错误
164 | D. 以上都不对
165 | >>>A
166 | ######
167 | ***Java语言基础***
168 | 20,分析以下代码,正确的选项是:( )
169 | [[[program020.png]]]
170 | A. 打印9 8 7
171 | B. 打印9 8 7 6
172 | C. 打印9 8 7 6 5
173 | D. 以上都不对
174 | >>>B
175 | ######
--------------------------------------------------------------------------------
/src/main/resources/applicationContext.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | cn.lynu.lyq.java_exam.entity.Student
40 | cn.lynu.lyq.java_exam.entity.Grade
41 | cn.lynu.lyq.java_exam.entity.Exam
42 | cn.lynu.lyq.java_exam.entity.ExamStrategy
43 | cn.lynu.lyq.java_exam.entity.ExamQuestion
44 | cn.lynu.lyq.java_exam.entity.StudentExamScore
45 | cn.lynu.lyq.java_exam.entity.ExamQuestionAnswer
46 | cn.lynu.lyq.java_exam.entity.BankQuestion
47 | cn.lynu.lyq.java_exam.entity.BankChoiceQuestion
48 | cn.lynu.lyq.java_exam.entity.BankBlankFillingQuestion
49 | cn.lynu.lyq.java_exam.entity.BankJudgeQuestion
50 |
51 |
52 |
53 |
54 | org.hibernate.dialect.MySQLDialect
55 | update
56 | false
57 | true
58 |
59 |
60 |
61 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/main/java/cn/lynu/lyq/java_exam/dao/impl/ExamQuestionDaoImpl.java:
--------------------------------------------------------------------------------
1 | package cn.lynu.lyq.java_exam.dao.impl;
2 |
3 | import java.util.List;
4 |
5 | import javax.annotation.Resource;
6 |
7 | import org.hibernate.Query;
8 | import org.hibernate.SessionFactory;
9 | import org.slf4j.Logger;
10 | import org.slf4j.LoggerFactory;
11 | import org.springframework.stereotype.Component;
12 | import org.springframework.transaction.annotation.Propagation;
13 | import org.springframework.transaction.annotation.Transactional;
14 |
15 | import cn.lynu.lyq.java_exam.dao.ExamQuestionDao;
16 | import cn.lynu.lyq.java_exam.entity.BankBlankFillingQuestion;
17 | import cn.lynu.lyq.java_exam.entity.BankChoiceQuestion;
18 | import cn.lynu.lyq.java_exam.entity.BankJudgeQuestion;
19 | import cn.lynu.lyq.java_exam.entity.Exam;
20 | import cn.lynu.lyq.java_exam.entity.ExamQuestion;
21 |
22 | @Component("examQuestionDao")
23 | @Transactional
24 |
25 | public class ExamQuestionDaoImpl implements ExamQuestionDao {
26 | private final static Logger logger = LoggerFactory.getLogger(ExamQuestionDaoImpl.class);
27 | @Resource
28 | private SessionFactory sessionFactory;
29 |
30 | public void setSessionFactory(SessionFactory sessionFactory) {
31 | this.sessionFactory = sessionFactory;
32 | }
33 |
34 | @Override
35 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
36 | public ExamQuestion findById(int id) {
37 | ExamQuestion eq = sessionFactory.getCurrentSession().load(ExamQuestion.class, id);
38 | return eq;
39 | }
40 |
41 | @SuppressWarnings("unchecked")
42 | @Override
43 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
44 | public List findAll(){
45 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamQuestion");
46 | return q.list();
47 | }
48 |
49 | @SuppressWarnings("unchecked")
50 | @Override
51 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
52 | public List findByExam(Exam exam) {
53 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamQuestion where exam=?0");
54 | q.setParameter("0", exam);
55 | return q.list();
56 | }
57 |
58 | @SuppressWarnings("unchecked")
59 | @Override
60 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
61 | public List findByBankChoiceQuestion(BankChoiceQuestion question) {
62 | logger.debug("question="+question);
63 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamQuestion where bankChoiceQuestion=?0");
64 | q.setParameter("0", question);
65 | return q.list();
66 | }
67 |
68 | @SuppressWarnings("unchecked")
69 | @Override
70 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
71 | public List findByBankBlankFillingQuestion(BankBlankFillingQuestion question) {
72 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamQuestion where bankBlankFillingQuestion=?0");
73 | q.setParameter("0", question);
74 | return q.list();
75 | }
76 |
77 | @SuppressWarnings("unchecked")
78 | @Override
79 | @Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
80 | public List findByBankJudgeQuestion(BankJudgeQuestion question) {
81 | Query q=sessionFactory.getCurrentSession().createQuery("from ExamQuestion where bankJudgeQuestion=?0");
82 | q.setParameter("0", question);
83 | return q.list();
84 | }
85 |
86 | @Override
87 | public void save(ExamQuestion eq){
88 | sessionFactory.getCurrentSession().save(eq);
89 | }
90 | @Override
91 | public void update(ExamQuestion eq){
92 | sessionFactory.getCurrentSession().update(eq);
93 | }
94 | @Override
95 | public void delete(ExamQuestion eq){
96 | sessionFactory.getCurrentSession().delete(eq);
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------