标签:nbsp inter lan col 用户名 form lis str als
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="0.jsp" method="post" >
<table align="center" border="1" width="400" >
<tr>
<td>用户名称 :</td>
<td><input type="text" name="username" size=46/></td>
</tr>
<tr>
<td>用户密码 :</td>
<td><input type="password" name="password" size=47 /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="用户登录" /></td>
</tr>
</table>
</form>
</body>
</html>
<%@page import="java.util.Date"%> <%@page import="java.text.SimpleDateFormat"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body color="pink"> <br><br> <% SimpleDateFormat simpleDateFormat=new SimpleDateFormat("HH:mm:ss"); Date currenTime=new Date(); String time=simpleDateFormat.format(currenTime).toString(); out.print("当前时间:"+time); %> <form action="1.jsp" method="get"> <table align="center" border="1" width="600"> <tr> <td> 生成题目数量 </td> <td > <input type="text" name="num" /> </td> <td colspan="2"> <input type="submit" value="提交" /> </td> </tr> <tr> <td>题号</td><br> <td>题目</td><br> <td>计算结果</td><br> <td>答案</td><br> </tr> </table> </form> </body> </html>
<%@page import="dao.OperationDaoImpl"%> <%@page import="dao.IOperationDao"%> <%@page import="java.util.ArrayList" %> <%@page import="java.util.List" %> <%@page import="java.util.*" %> <%@page import="dao.Operation "%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <SCRIPT LANGUAGE="JavaScript"> var maxtime = 30 //半个小时,按秒计算,自己调整! function CountDown(){ if(maxtime>=0){ seconds = Math.floor(maxtime%30); msg = "距离结束还有"+seconds+"秒"; document.all["timer"].innerHTML=msg; if(maxtime == 5) alert(‘注意,还有5秒!‘); --maxtime; } else{ clearInterval(timer); alert("时间到,结束!"); window.location.href="2.jsp"; } } timer = setInterval("CountDown()",1000); </SCRIPT> </head> <% %> <body> <div id="timer" style="color:ffff00" align="center"></div> <% int a=Integer.parseInt(request.getParameter("num")); OperationDaoImpl operationDaoImpl=new OperationDaoImpl(); List<Operation> list=new ArrayList<Operation>(); Operation operation=new Operation(); String id=""; String result=""; Random random=new Random(); for(int i=0;i<a/2;i++) { int b=random.nextInt(98)+1; id=id+" "+b; operation=operationDaoImpl.loadMultiply(b).get(i); result=result+" "+operation.getStoreResult(); list.add(operation); } for(int j=a/2;j<a;j++) { int c=random.nextInt(98)+1; id=id+" "+c; operation=operationDaoImpl.loadAdd(c).get(j); result=result+" "+operation.getStoreResult(); list.add(operation); } session.setAttribute("id", id); session.setAttribute("result", result); %> <form action="2.jsp" method="get" color="red"> <table align="center" border="1" width="600"> <tr> <td colspan="2" width="70%" align="center"> 生成题目数量 </td> <td colspan="2" > <input type="text" name="num1" size=35/> </td> </tr> <tr> <td width="20%">题号</td><br> <td >题目</td><br> <td>计算结果</td><br> <td hidden> <input type="hidden",name="solution",value="答案"/> </td><br> </tr> <% int i=1; for(Operation operation1:list){ %> <tr> <td><%=i %></td> <td><%=operation1.getStoreOperation()%></td> <td> <input style="text" name="result" /></td> <% %> </tr> <% i++;} %> <tr> <td colspan="4" align="center"> <input type="submit" ,value="提交试卷" /> </td> </tr> </table> </form> </body> </html>
<%@page import="dao.OperationDaoImpl"%> <%@page import="dao.IOperationDao"%> <%@page import=" java.util.ArrayList" %> <%@page import=" java.util.List" %> <%@page import=" java.util.*" %> <%@page import="dao.Operation "%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <% String arr[]=request.getParameterValues("result"); Operation operation = new Operation(); OperationDaoImpl operationDaoImpl = new OperationDaoImpl(); List<Operation> list = new ArrayList<Operation>(); String id = (String) session.getAttribute("id"); String Result = (String) session.getAttribute("result"); String Id[] = id.toString().trim().split(" "); String result[] = Result.toString().trim().split(" "); for (int i = 0; i < Id.length / 2; i++) { operation = operationDaoImpl.loadMultiply(Id.length).get(i); list.add(operation); } for (int i = Id.length / 2; i < Id.length; i++) { operation = operationDaoImpl.loadAdd(Id.length).get(i); list.add(operation); } for (int j = 0; j < result.length; j++) { System.out.println(result[j]); } %> <form> <table align="center" border="1" width="600"> <tr> <td colspan="2" width="70%" align="center"> 生成题目数量 </td> <td colspan="2" > <input type="text" name="num" size=35/> </td> </tr> <tr> <td width="20%">题号</td><br> <td >题目</td><br> <td>计算结果</td><br> <td>答案</td><br> </tr> <tr> <% int i=0; for(Operation operation1:list){ %> <tr> <td><%=i+1 %></td> <td><%=operation1.getStoreOperation() %></td> <td> <% if(result[i].equals(list.get(i).getStoreResult())) { %> <font style="color: blue;"> <% out.print(arr[i]);%> </font> <% } else { %> <font style="color: red;"> <% out.print(arr[i]);%> </font> <% } %> </td> <td><%=operation1.getStoreResult()%></td> </tr> <% i++; } session.invalidate(); %> </table> </form> </body> </html>
标签:nbsp inter lan col 用户名 form lis str als
原文地址:http://www.cnblogs.com/xiaohaigege666/p/7994215.html