1、问题
<html>
<head>
<title>问题</title>
</head>
<body>
<form action="提交.jsp" name="example" method="post">
<p>考试开始,总分为15分</p>
<p>一、单选题(5分)</p>
<p>第一题:</p>
<p>“中国的四大古典名著为 <br>
<input type="checkbox" name="chanjuan" value="A">《诗经》
<input type="checkbox" name="chanjuan" value="B">《西游记》
</p><br>
<p>第二题:</p>
<p>静态网站的后缀名<br>
<input type="checkbox" name="xishi" value="A">.jsp
<input type="checkbox" name="xishi" value="B">.jpeg
<input type="checkbox" name="xishi" value="C">.html
<input type="checkbox" name="xishi" value="D">.css
</p>
<p>第三题:</p>
<p>padding是距哪里的位置?<br>
<input type="checkbox" name="tusu" value="A">内部
<input type="checkbox" name="tusu" value="B">外部
<input type="checkbox" name="tusu" value="C">上部
<input type="checkbox" name="tusu" value="D">下部
</p>
<p>第四题:</p>
<p>“床前明月光”是李白的千古名句,其中 “床”指的是什么?<br>
<input type="checkbox" name="chuang" value="A">窗户
<input type="checkbox" name="chuang" value="B">卧具
<input type="checkbox" name="chuang" value="C">井上的围栏
</p>
<p>第五题:</p>
<p>1932年,清华大学招生试题中有一道对对子题,上联“孙行者”,下面下联中最合适的是:<br>
<input type="checkbox" name="heshi" value="A">胡适之
<input type="checkbox" name="heshi" value="B">周树人
<input type="checkbox" name="heshi" value="C">郁达夫
<input type="checkbox" name="heshi" value="D">唐三藏
</p>
<p>二、判断题(5分)</p>
<p>第一题:</p>
<p>1. 苏轼的《前赤壁赋》采用的抑主伸客的表现方式 <br>
<input type="checkbox" name="dongwu" value="对">√
<input type="checkbox" name="dongwu" value="错">X
</p><br>
<p>第二题:</p>
<p>2. 宋词是元杂剧与元散曲的合称 <br>
<input type="checkbox" name="jingshui" value="对">√
<input type="checkbox" name="jingshui" value="错">X
</p><br>
<p>第三题:</p>
<p>3. 唐传奇是唐代流行的文言散文 <br>
<input type="checkbox" name="diqiu" value="对">√
<input type="checkbox" name="diqiu" value="错">X
</p><br>
<p>第四题:</p>
<p>4. “反思小说”具有更多的理性色彩 和悲剧意味<br>
<input type="checkbox" name="fuli" value="对">√
<input type="checkbox" name="fuli" value="错">X
</p><br>
<p>第五题:</p>
<p>5. 鲁迅又是现代杂文的开拓者 <br>
<input type="checkbox" name="kongqi" value="对">√
<input type="checkbox" name="kongqi" value="错">X
</p><br>
<p>
<input type="submit" value="提交答案"/>
<input type="reset" value="清除答案"/>
</p>
</form>
</body>
</html>
2.提交
<html>
<head>
<title>tijiao</title>
</head>
<body>
<h3>考生选择的答案为:</h3>
<%! int score=0; %>
<%
String[] chanjuan = request.getParameterValues("chanjuan");
if(chanjuan != null){
for(int i=0;i<chanjuan.length;i++){
if(chanjuan[i].equals("A")){
out.println("<p style='color:red'>姻缘 答案错误!<br>");
}
if(chanjuan[i].equals("B")){
out.println("<p style='color:green'>月亮 答案正确<br>");
score +=1;
}
}
}
String[] xishi = request.getParameterValues("xishi");
if(xishi != null){
for(int i=0;i<xishi.length;i++){
if(xishi[i].equals("A")){
out.println("<p style='color:green'>妻子生了个男孩 答案正确<br>");
score +=1;
}
if(xishi[i].equals("B")){
out.println("<p style='color:red'>新婚 答案错误!<br>");
}
if(xishi[i].equals("C")){
out.println("<p style='color:red'>搬家 答案错误!<br>");
}
if(xishi[i].equals("D")){
out.println("<p style='color:red'>考试通过 答案错误!<br>");
}
}
}
String[] tusu = request.getParameterValues("tusu");
if(tusu != null){
for(int i=0;i<tusu.length;i++){
if(tusu[i].equals("A")){
out.println("<p style='color:red'>苏州 答案错误<br>");
}
if(tusu[i].equals("B")){
out.println("<p style='color:red'>房屋 答案错误!<br>");
}
if(tusu[i].equals("C")){
out.println("<p style='color:green'>酒 答案正确!<br>");
score +=1;
}
if(tusu[i].equals("D")){
out.println("<p style='color:red'>庄稼 答案错误!<br>");
}
}
}
String[] chuang = request.getParameterValues("chuang");
if(chuang != null){
for(int i=0;i<chuang.length;i++){
if(chuang[i].equals("A")){
out.println("<p style='color:red'>窗户 答案错误<br>");
}
if(chuang[i].equals("B")){
out.println("<p style='color:red'>卧具 答案错误!<br>");
}
if(chuang[i].equals("C")){
out.println("<p style='color:green'>井上的围栏 答案正确!<br>");
score +=1;
}
}
}
String[] heshi = request.getParameterValues("heshi");
if(heshi != null){
for(int i=0;i<heshi.length;i++){
if(heshi[i].equals("A")){
out.println("<p style='color:green'>胡适之 答案正确<br>");
score +=1;
}
if(heshi[i].equals("B")){
out.println("<p style='color:red'>周树人 答案错误!<br>");
}
if(heshi[i].equals("C")){
out.println("<p style='color:red'>郁达夫 答案错误!<br>");
}
if(heshi[i].equals("D")){
out.println("<p style='color:red'>唐三藏 答案错误!<br>");
}
}
}
String[] jingshui = request.getParameterValues("jingshui");
if(jingshui != null){
for(int i=0;i<jingshui.length;i++){
if(jingshui[i].equals("对")){
out.println("<p style='color:red'>√ 答案错误!<br>");
}
if(jingshui[i].equals("错")){
out.println("<p style='color:green'>X 答案正确!<br>");
score +=1;
}
}
}
String[] diqiu = request.getParameterValues("diqiu");
if(diqiu != null){
for(int i=0;i<diqiu.length;i++){
if(diqiu[i].equals("对")){
out.println("<p style='color:red'>√ 答案错误!<br>");
}
if(diqiu[i].equals("错")){
out.println("<p style='color:green'>X 答案正确!<br>");
score +=1;
}
}
}
String[] fuli = request.getParameterValues("fuli");
if(fuli != null){
for(int i=0;i<fuli.length;i++){
if(fuli[i].equals("对")){
out.println("<p style='color:red'>√ 答案错误!<br>");
}
if(fuli[i].equals("错")){
out.println("<p style='color:green'>X 答案正确!<br>");
score +=1;
}
}
}
String[] kongqi = request.getParameterValues("kongqi");
if(kongqi != null){
for(int i=0;i<kongqi.length;i++){
if(kongqi[i].equals("对")){
out.println("<p style='color:red'>√ 答案错误!<br>");
}
if(kongqi[i].equals("错")){
out.println("<p style='color:green'>X 答案正确!<br>");
score +=1;
}
}
}
out.print("<br>得分为:"+score);
score = 0;
%>
</body>
</html>