action部分:

String questionkindId;
String questionCon;
String choicea;
String choiceb;
String choicec;
String choiced;
String result;

生成getter和setter方法,由于应用了ssh框架,因此只要在action中定义与JSP页面中name名称相同的属性,并生成setter和getter,并在JSP中定义<form action="AddQuestion.action"  method="post">,即可自动获取JSP表单中的内容。

public String AddQuestion_wanxing(){
for(int i=0;i<choiceas.length;i++){
Boolean success=questionservice.AddQuestion_wanxing(questionkindId, questionCon, choiceas, choicebs, choicecs, choiceds, results, questionAnas, questionknows,errorRate,difficult,QuestionDetailIds);

if(success) return "success";

else return "failure";
}
return "failure";
}

service层:

public Boolean AddQuestion_wanxing(String questionkindId,
String questionCon, String[] choiceas, String[] choicebs,
String[] choicecs, String[] choiceds, String[] results,
String[] questionAnas, String[] questionknows, String errorRate,
String difficult, String[] questionDetailIds);

serviceimplement层:

public Boolean AddQuestion(String questionkindId, String questionCon,
String choicea, String choiceb, String choicec, String choiced,
String result, String questionAna, String questionknow,String errorRate,String difficult,String QuestionDetailId) {
try {
return questiondao.AddQuestion(questionkindId, questionCon, choicea, choiceb, choicec, choiced, result, questionAna, questionknow,errorRate,difficult,QuestionDetailId);

} catch (Exception e) {
// TODO: handle exception
return false;
}
}

dao层:

public Boolean AddQuestion_wanxing(String questionkindId,
String questionCon, String[] choiceas, String[] choicebs,
String[] choicecs, String[] choiceds, String[] results,
String[] questionAnas, String[] questionknows, String errorRate,
String difficult, String[] questionDetailIds);

daoimplement层:

public Boolean AddQuestion(String questionkindId, String questionCon,
String choicea, String choiceb, String choicec, String choiced,
String result, String questionAna, String questionknow,String errorRate,String difficult,String QuestionDetailId) {

// TODO Auto-generated method stub
try {
Question question=new Question();
question.setQuestionKind(Integer.parseInt(questionkindId));
question.setQuestionCon(questionCon);
question.setQuestionErrorRate(Float.valueOf(errorRate));
question.setQuestionDifficult(Integer.parseInt(difficult));

if((Integer.parseInt(questionkindId))==1){
question.setQuestionNumber(1);}
else if((Integer.parseInt(questionkindId))==2){
question.setQuestionNumber(20);
}
else if((Integer.parseInt(questionkindId))==3){
question.setQuestionNumber(5);
}

// QuestionDetail detail=(QuestionDetail) question.getQuestionDetails();

QuestionDetail detail = new QuestionDetail();
int detailid=Integer.parseInt(QuestionDetailId);
QuestionDetailId ID = new QuestionDetailId(question, detailid);
detail.setId(ID);
detail.setSelectA(choicea);
detail.setSelectB(choiceb);
detail.setSelectC(choicec);
detail.setSelectD(choiced);
detail.setSelectans(result);
detail.setSelectExplain(questionAna);
detail.setSelectKnowledge(questionknow);
question.getQuestionDetails().add(detail);

getHibernateTemplate().save(question);
return true;

} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return false;
}

}

JSP页面部分:

<html>
  <head>
    <base href="<%=basePath%>">
<script type="text/javascript">
     function check(select){
      var gra=document.getElementById('gra');
      var name=document.getElementById('name');
      var s=select.selectedIndex+1; 
      if(s==1){
      sch.style.display="block";
      gra.style.display="block";
      }
      else if(s==2){
       sch.style.display="block";
       gra.style.display="none";
      }
      else if(s==3){
  sch.style.display="none";
gra.style.display="none";
      }
     }     
    </script> 
    
    <title>组卷与考试管理系统-增加用户</title>
    
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>
<div>
<h3>新增题目</h3>
    <form action="AddQuestion.action"  method="post">
    <table id="parent">
         <tr>
       <td>题目类型:</td>
       <td >选择题</td>
       <td><input type="hidden"  name="questionkindId" value="1" style="height: 153px; width: 676px"/></td>
      <td><input type="hidden"  name="QuestionDetailId" value="1" style="height: 153px; width: 676px"/></td>
       </tr> 
      <tr>
          <td>题干部分</td>
          <td><input type="text"  name="questionCon" style="height: 153px; width: 676px"/></td>
      </tr>
      <tr>
          <td>选项A</td>
          <td><input type="text" name="choicea" style="width: 683px; "/></td>
      </tr>
          <tr>
          <td>选项B</td>
          <td><input type="text" name="choiceb" style="width: 683px; "/></td>
      </tr>
            <tr>
          <td>选项C</td>
          <td><input type="text" name="choicec" style="width: 683px; "/></td>
      </tr>
            <tr>
          <td>选项D</td>
          <td><input type="text" name="choiced" style="width: 683px; "/></td>
      </tr>  
      <tr>
          <td>答案:</td>
          <td>
         <table><tr>
         <td width="50"><input type="radio" name="result" value="A" checked="checked" />A</td>
         <td width="50"><input type="radio" name="result" value="B" />B</td>
         <td width="50"><input type="radio" name="result" value="C" />C</td>
         <td width="50"><input type="radio" name="result" value="D"/>D</td>
         </table> 
      </tr>
      <tr >
          <td>问题解析</td>
          <td><input type="text" name="questionAna" style="width: 688px; height: 86px"/></td>
       </tr>   
            <tr >
          <td>知识点</td>
          <td><input type="text" name="questionknow" style="width: 683px; "/></td>
       </tr>  
       <tr>
       <td>错误率</td>
       <td><input type="text" name="errorRate" style="width: 683px; "/></td>
       </tr>
       
       <tr>
       <td>难度</td>
       <td><input type="text" name="difficult" style="width: 683px; "/></td>
       </tr>
       <tr>
           <td><input type="submit" value="添加"/></td>
           <td><input type="reset" value="重置"></td>
       </tr>
    </table>
    </form>
    </div>
</body>

</html>


bean.XML部分

<bean id="IquestionDao" class="com.exam.dao.impl.IquestionDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="Iquestionservice" class="com.exam.service.impl.IquestionServiceImpl">
<property name="questiondao" ref="IquestionDao"></property>
</bean>

<bean id="QuestionAction" class="com.exam.action.QuestionAction">
<property name="questionservice" ref="Iquestionservice"></property>
</bean>

struct.xml部分:

<package name="Tiku" namespace="/" extends="struts-default">

<action name="findquestion" class="QuestionAction" method="findquestion">
<result name="success">teacher/success.jsp</result>
<result name="failure">teacher/error.jsp</result>
</action>
<action name="AddQuestion" class="QuestionAction" method="AddQuestion">
<result name="success">teacher/success.jsp</result>
<result name="failure">teacher/error.jsp</result>
</action>
<action name="AddQuestion_wanxing" class="QuestionAction" method="AddQuestion_wanxing">
<result name="success">teacher/success.jsp</result>
<result name="failure">teacher/error.jsp</result>
</action>
</package>

组卷与考试系统_题库添加选择题模块相关推荐

  1. Python课程设计:Python语言实现自动组卷评卷考试系统

    Python实现自动组卷评卷考试系统 课程设计要求 一.各个模块介绍及实现 1. Configure.py 2. File_Texture_Tree.py 3. 后端:Test_Problem_Con ...

  2. Python版自动组卷评卷考试系统,具有考试定时、自动组卷、客观题自动判卷、自动评分和考试界面设计功能

    一.实验项目名称: 自动组卷评卷考试系统 二.实验内容 用Python语言编程实现自动组卷评卷考试系统,软件主要功能包括:从题库中随机抽取试题自动组成试卷(满分100分):实现考生考试答题操作界面:实 ...

  3. 基于Python 实现自动组卷评卷考试系统【100010913】

    自动组卷评卷考试系统 实验内容 用Python语言编程实现自动组卷评卷考试系统,软件主要功能包括:从题库中随机抽取试题自动组成试卷(满分100分):实现考生考试答题操作界面:实现自动阅卷评分功能:等等 ...

  4. 语言在线组卷系统_如何使用在线考试系统创建题库?

    一款优秀的在线考试系统,应该具备试题导入.编辑.查重.导出.组卷等功能,用户可以将试题录入到系统,组建自己的题库,方便用户进行试题资源的整理和共享. 下面我们就以考试云为例,来说一说,怎样才能创建一个 ...

  5. 万维考试系统python题库答案_万维试题库系统官方下载

    万维试题库管理系统是一款相当出色的考试软件,软件拥有很多功能如课程定义,题型支持.试题批量识别导入,雷同试题检测,随机组卷和手工组卷流程控制,透明压缩,双向缓冲处理,数据导入导出共享,相当实用. 基本 ...

  6. 万维考试系统python题库答案_万维全自动考试系统操作手册

    万维全自动网络考试平台 考试设置操作流程 1 / 29 万维捷通软件技术有限公司. 万维全自动网络考试平台 .............................................. ...

  7. 07——驾校科目一考试系统——布局题库

    文章目录 总代码 examdialog.h examdialog.cpp 运行效果 重要知识点总结(从代码中提炼出来的) 初始化布局 打开文件并设置字符集 将文本框就设置为只读属性 对于文本内数据的操 ...

  8. python资源管理器 计算机项目下的_高级语言程序设计(Python)_中国大学MOOC(慕课)_题库及答案...

    高级语言程序设计(Python)_中国大学MOOC(慕课)_题库及答案 来源:未知 编辑:admin 时间:2020-06-30 更多相关问题 以下选项中能正确调用fun函数的语句是charfun(c ...

  9. 北师大计算机试题六答案,2019年度全国计算机二级考试-试题资料题库(附答案解析).doc...

    2019年度全国计算机二级考试-试题资料题库(附答案解析).doc 2019年全国计算机二级考试试题题库(附答案)一.选择题1-40每小题1分,41-50每小题2分,共60分下列各题 A .B.C.D ...

最新文章

  1. Python:数据集成
  2. 百度2011实习生招聘笔试题
  3. 英伟达3080Ti、3070Ti来了:继续封锁挖矿性能,网友:不信,空气卡+1
  4. python编程需要什么软件-python编程用哪个软件
  5. (转载)机器学习知识点(十三)吉布斯采样法(Gibbs Sampling)
  6. JavaScript——分时问候
  7. Java的新项目学成在线笔记-day14(四)
  8. java config 类_Spring ----JavaConfig类代替XML配置Bean
  9. 5种高大上的yml读取方式,你知道几种?
  10. malloc(): corrupted top size
  11. Windows 7 SP1 旗舰版 MSDN原版
  12. 如何修改远程服务器登录密码
  13. 基于mpvue创建微信小程序项目
  14. 一个中国码农在硅谷求职的实用经历
  15. 5G+工业互联网行业解决方案
  16. 用PS快速给图片添加逼真彩虹效果
  17. ijkplayer设置rtmp秒开
  18. sql语言学习——数据定义语言
  19. Unity Awake OnEnable Start 和Update 先后顺序探究
  20. Java实现发送手机验证码,发送短信

热门文章

  1. 移动网络能“接管”生活?2014十大猜想
  2. 【新2023Q2模拟题JAVA】华为OD机试 - 预订酒店
  3. 如何用计算机求特征值特征向量,利用QR算法求解矩阵的特征值和特征向量
  4. 亮化工程改善城市夜景有什么重要意义
  5. 富途证券面试整理--前端
  6. 骁龙8gen2和苹果A15哪个好 骁龙8gen2和A15对比
  7. JAVA并发编程-视频教程
  8. 阎王爷让我给他做个后台管理系统(转)
  9. 卡刷刷机包出现 Error 7
  10. 计算机组成原理三种译码方式,计算机组成原理第三章存储系统