<%--程序input.jsp--%> <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>简单的网上试题自动测评——试题</title> </head> <body> <form action="show.jsp"method="post"> 一、2+3=?<br> <input type="radio"name="r1"value="2"checked="checked">2 <input type="radio"name="r1"value="3">3 <input type="radio"name="r1"value="4">4 <input type="radio"name="r1"value="5">5<br> 二、下列哪些是偶数?<br> <input type="checkbox"name="c1"value="2">2 <input type="checkbox"name="c1"value="2">3 <input type="checkbox"name="c1"value="2">4 <input type="checkbox"name="c1"value="2">5<br> 三、下列哪些是动态网页?<br> <select size="4"name="list1"multiple="multiple"> <option value="asp">ASP</option> <option value="php">PHP</option> <option value="html">HTML</option> <option value="jsp">JSP</option> <option value="xyz"selected="selected">XYZ</option> </select><br> 四、下列组件哪个是服务器端的?<br> <select size="1"name="list2"> <option value="jsp">JSP</option> <option value="servlet">SERVLET</option> <option value="java">JAVA</option> <option value="jdbc">JDBC</option> </select><br> 五、在服务器端用来接收用户请求的对象是:<br> <input type="text"size="20"name="text1"><br> <div align="left"> <blockquote> <input type="submit"value="提交"name="button1"> <input type="reset"value="重置"name="button2"> </blockquote> </div> </form> </body> </html> <%--程序show.jsp--%> <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <html> <head> <title>简单的网上试题自动测评——测评</title> </head> <body> <% String s1=request.getParameter("r1"); if(s1!=null){ out.println("一、解答为:2+3="+s1+" "); if(s1.equals("5")) out.println("正确!"+"<br>"); else out.println("错误!"+"<br>"); } else out.println("一、没有解答!"); out.println("----------------------<br>"); String[] s21=request.getParameterValues("c1"); if(s21!=null){ out.println("二、解答为:偶数有:"); for(int i=1;i<s21.length;i++) {out.println(s21[i]+" ");} if(s21.length==2&&s21[0].equals("2")&&s21[1].equals("4")) out.println("正确!"+"<br>"); else out.println("错误!"+"<br>"); } else out.println("二、没有解答!"); out.println("----------------------<br>"); String[] s31=request.getParameterValues("list1"); if(s31!=null){ out.println("三、解答为:动态网页有:"); for(int i=1;i<s31.length;i++) {out.println(s31[i]+" ");} if(s31.length==3&&s31[0].equals("asp")&&s31[1].equals("php")&&s31[2].equals("jsp")) out.println("正确!"+"<br>"); else out.println("错误!"+"<br>"); } else out.println("三、没有解答!"); out.println("----------------------<br>"); String s4=request.getParameter("list2"); if(s4!=null){ out.println("四、解答为:服务器端的组件是有;"); out.println(s4+" "); if(s4!=null&&s4.equals("servlet")) out.println("正确!"+"<br>"); else out.println("错误!"+"<br>"); } else out.println("四、没有解答!"); out.println("----------------------<br>"); String s5=request.getParameter("text1"); if(s5!=null){ out.println("五、解答为"); out.println(s5+" "); if(s5!=null&&s5.equals("request")) out.println("正确!"+"<br>"); else out.println("错误!"+"<br>"); } else out.println("五、没有解答!"); out.println("----------------------<br>"); %> </body> </html>