JSP版考试系统

最近的一个任务是公司试用的JSP版考试系统,感觉就是练笔用的。以前笔试的时候是.Net版本,这次是java,大同小易,不过都是让学员仿写

的而已,首先是实现读取.properties中的文件,包括了如何在tomcat上获得相对路径的方法,其中有不少波折,感觉能独立地分离出要实现的

功能进行独立的测试是最好的,然后就是糊里糊涂忙了一下午的中文编码问题和数字转字符,基本上以放弃告终。接下来是生成页面的表格行

宽控制,最后还是用dreamweaver改。晚上又让在start的时候发一封,提交的时候发2封给hr,基本参考2封给笔试人的成例写了出来。添加了

验证email格式的javascript。即将实现一个录入题库的页面。搞了老半天才搞定单form的多submit。

接着尽量完善,过程绝对是痛苦的,不知什么时候才是尽头,jacky加入了,一起研究发现原来的版本到底有多烂,看得吐血,jacky学得很好

,比我强多了,我开始反省这么久以来自己到底学了些什么,方法,方向,还有程度,都在思考,确定的是知识就是工具,而我们需要的是能

够熟练使用工具做自己想做的事。晚上吃饭,几个人聊了一下先后进来的经历,只是很零碎地谈了一些,却帮助我了解了很多他人的想法。

又过了半个星期多,包括题目录入在内的所以项目代码基本完工,简单测试了一下,确保除首页外获得的都是servlet,而由中间页submit都会

跳转回首页,相关的验证测试也基本完成,绝对交付leader了,但愿经得起他的考验吧。

 

http://172.16.113.14/ltiwebsite/interview/Default.aspx
http://172.16.113.14/ltiwebsite/interview/AddQuestion.aspx


http://localhost:8080/exam/index.jsp
http://localhost:8080/exam/AddQuestion.jsp
http://localhost:8080/exam/AddJuniorQuestion.jsp
http://localhost:8080/exam/AddSeniorQuestion.jsp

 

读取properties
tomcat上相对路径的寻址
提交的时候发2封给hr2,2封给笔试人。
加name tel email验证
结束显示成绩,跳转到index
防止中间页渗透
start的时候发一封hr1.
.net中提交页面文字也会放大。
统计分数,修改bt的答案验证功能。
清session,不可后退
多种组合中,1,3,4,5只选junior(1),2能选2个,6只选senior,但senior(2)
重点剩下录入题库
防止中间页访问
检查其他容错
独立的测试

directions:start from the begin
html,xml,http/tcp/ip,javascript,jsp.jstl,struts,spring,hibernate,
learn it from beginning


another issue ---windows status bar
 

Q_ID(int)Question_Type(char)Question_Desc(nvarchar)Question_Mark(char)
Q_ID(java.lang.Integer)Question_Type(java.lang.String)Question_Desc(java.lang.String)Question_Mark(java.lang.String)
Q_ID(11)Question_Type(1)Question_Desc(4000)Question_Mark(1)
sql = "select * from question";


A_ID(int)Q_ID(int)Answer_Desc(nvarchar)Check(int)
A_ID(java.lang.Integer)Q_ID(java.lang.Integer)Answer_Desc(java.lang.String)Check(java.lang.Integer)
A_ID(11)Q_ID(11)Answer_Desc(4000)Check(11)
sql = "select * from answer";

 

 

String qType = "1";
   String qDesc = "for_test......";
   String qMark = "1";

   String insertSql = "insert into question(Question_Type,Question_Desc,Question_Mark)"
     + " values(?,?,?) SELECT SCOPE_IDENTITY() AS Q_ID";
   String querySql = "select Q_ID,Question_Type,Question_Desc,Question_Mark from question where Question_Desc='"
     + qDesc + "'";
   ResultSet rs;

   ArrayList arrayList = new ArrayList();
   arrayList.add(qType);
   arrayList.add(qDesc);
   arrayList.add(qMark);

   try {
    rs = DbUtil.getInstance().querySqlCmdWithParams(insertSql, arrayList);
    
    if(rs.next()){
    querySql = "select Q_ID,Question_Type,Question_Desc,Question_Mark from question where Q_ID="
     +(rs.getInt(1));}
    
    rs = DbUtil.getInstance().openResultset(querySql);
    while (rs.next()) {
     System.out.println(rs.getInt("Q_ID"));
     System.out.println(rs.getString("Question_Type"));
     System.out.println(rs.getString("Question_Desc"));
     System.out.println(rs.getString("Question_Mark"));
    }

 

 

   String qid = "1000000";
   String aDesc = "for_test...";
   String aCheck = "0";
   
   String insertSql = "insert into answer(Q_ID,Answer_Desc,[Check])" + " values(?,?,?)";
   String querySql = "select a.A_ID,a.Q_ID,a.Answer_Desc,a.[Check] as ch from answer as a where Q_ID="+qid;
   ResultSet rs ;
   
   ArrayList arrayList = new ArrayList();   
   arrayList.add(qid);
   arrayList.add(aDesc);
   arrayList.add(aCheck);
   try {
    DbUtil.getInstance().execSqlCmdWithParams(insertSql, arrayList);
    
    rs = DbUtil.getInstance().openResultset(querySql);
    while(rs.next()){
     System.out.println(rs.getInt("A_ID"));
     System.out.println(rs.getInt("Q_ID"));
     System.out.println(rs.getString("Answer_Desc"));
     System.out.println(rs.getInt("ch"));
    }
    
    DbUtil.getInstance().close();   
   } catch (Exception e) {
    e.printStackTrace();
   }

 

 


try {
   /*
    *
    */
   
   String qType = "1";
   String qDesc = "for_test......";
   String qMark = "1";   
   
   String aDesc = "for_test...answer1";
   String aCheck = "0";
   String qid = "10000000";
   String aid = "10000000";
   

String insertQSql = "insert into question(Question_Type,Question_Desc,Question_Mark) values(?,?,?) SELECT SCOPE_IDENTITY() AS Q_ID";
String insertASql = "insert into answer(Q_ID,Answer_Desc,[Check]) values(?,?,?) SELECT SCOPE_IDENTITY() AS A_ID";
String queryQSql = "select q.Q_ID as qid,q.Question_Type as qType,q.Question_Desc as qDesc,q.Question_Mark as qMark from question as q where Q_ID=";
String queryASql = "select a.A_ID as aid,a.Q_ID as qid,a.Answer_Desc as aDesc,a.[Check] as ch from answer as a where A_ID=";
  
   ResultSet rs;

   ArrayList arrayList = new ArrayList();
   arrayList.add(qType);
   arrayList.add(qDesc);
   arrayList.add(qMark);

   try {
    rs = DbUtil.getInstance().querySqlCmdWithParams(insertQSql, arrayList);
    
    if(rs.next()){
     qid = rs.getString(1);     
     }   
    queryQSql = queryQSql+qid;
    rs = DbUtil.getInstance().openResultset(queryQSql);
    while (rs.next()) {
     System.out.println(rs.getInt("qid"));
     System.out.println(rs.getString("qType"));
     System.out.println(rs.getString("qDesc"));
     System.out.println(rs.getString("qMark"));
    }
    
    System.out.println("----");
    
    
    arrayList = new ArrayList();
    arrayList.add(qid);
    arrayList.add(aDesc);
    arrayList.add(aCheck);
    
    
    rs = DbUtil.getInstance().querySqlCmdWithParams(insertASql,arrayList);
    if(rs.next()){
     aid = rs.getString(1);     
     }
    queryASql = queryASql+aid;
    rs = DbUtil.getInstance().openResultset(queryASql);
    while (rs.next()) {
     System.out.println(rs.getInt("aid"));
     System.out.println(rs.getInt("qid"));
     System.out.println(rs.getString("aDesc"));
     System.out.println(rs.getInt("ch"));
    }

    

    DbUtil.getInstance().close();
   } catch (Exception e) {
    e.printStackTrace();
   }

  }

  // Handle any errors that may have occurred.
  catch (Exception e) {
   e.printStackTrace();
  }

 

 

 


// Establish the connection.
   /*Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
   con = DriverManager.getConnection(connectionUrl);*/
   
   // Create and execute an SQL statement that returns some data.
   String sql = "select top 60 q.q_id as qid ,q.question_desc as question, a.answer_desc as answer ,a.[Check] AS ch"
    +" from question as q left join answer as a on q.q_id = a.q_id "
    +" where q.question_type ='1' and q.question_mark ='1' order by newid()";
   
   String q_id = "59";
   sql = "select cast(a.q_id as varchar(6))+'_'+cast(a.a_id as varchar(6)) as aqid from answer as a where a.[Check]=1 and a.q_id="+q_id;
   sql = "select count(a.[Check]) as count from answer as a where a.q_id in (59,60)";
   sql = "select * from question";
   
   //List list = DbUtil.getInstance().getResultset(sql);
   ResultSet rs = DbUtil.getInstance().openResultset(sql);
   /*stmt = con.createStatement();
   rs = stmt.executeQuery(SQL);*/

   // Iterate through the data in the result set and display it.
   /*while (rs.next()) {
    System.out.println(rs.getString(2) + " " + rs.getString(3));
   }*/
   //for(int i= 0; i<list.size();i++){
    //String count = ((HashMap)list.get(i)).get("count").toString();
    //System.out.println(count);}
   ResultSetMetaData rsmd = rs.getMetaData();
   int count = rsmd.getColumnCount();
   //rs.next();
   for(int i = 0;i<count;i++){
    System.out.print(rsmd.getColumnName(i+1)+",");
    //rsmd.getColumnTypeName(i+1);rsmd.getColumnClassName(i+1)
   }

 

 

document for exam system

http://172.16.113.14/LtiWebsite/Interview/admin/
http://172.16.113.14/ltiwebsite/interview/

http://www.longtopinternational.com/interview/admin/
http://www.longtopinternational.com/interview/

http://servicedesk.longtop.com/exam/
http://lti-station/exam

http://localhost:8080/JSPBook/
http://localhost:8080/

DonNet version :http://172.16.113.80/aspnetcode/interview/admin/
Java version http://localhost:8080/exam/

  http://172.16.113.102:8080/exam/

http://localhost:8080/exam/admin/
http://localhost:8080/exam/
http://localhost:8080/exam/CandidateLogin.jsp

test001@126.com

 

you can slow,even skip,but be careful

172.16.113.80
administrator
xchange
D:/aspnetcode/ltiwebsite.mdb


exam
di
northbayadventure

欢迎
参加的类型
出错联系
enable

 

读取properties
tomcat上相对路径的寻址
提交的时候发2封给hr2,2封给笔试人。
加name tel email验证
结束显示成绩,跳转到index
防止中间页渗透
start的时候发一封hr1.
.net中提交页面文字也会放大。
统计分数,修改bt的答案验证功能。
清session,不可后退
多种组合中,1,3,4,5只选junior(1),2能选2个,6只选senior,但senior(2)
重点剩下录入题库
防止中间页访问
检查其他容错
独立的测试

windows 2003 7
Exchange Server 8
ISA Server 9
SMS  10
MOM  11

change the db to access:
location
sql grammars

 

//172.16.113.226/Training/Windows 2003
here is the questions, please open the file and find the question then input it into database. 
"problems

 

录入题目bug

移出ps
留下一个eb
exam时newid
改qid和aid?

显示题目bug

去掉language.properties及相关引用languageutil.java


another issue ---windows status bar

http://lucene.apache.org/java/docs/


ProgrammingCurriculum
Property

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值