MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 急求助,javaBean的有关问题

急求助,javaBean的有关问题(2)

www.MyException.Cn  网友分享于:2013-11-29  浏览:223次

return   selection;
}
public   int   getScore(){
score=0;
int   length1=selection.length();
int   length2=correctAnswer.length();
int   min=(int)(Math.min(length1,length2));
int   i=0;
while(i <min){
if(selection.charAt(i)==correctAnswer.charAt(i))
score++;
i++;
}
return   score;
}

}
test.jsp
<%@   page   contentType= "text/html;charset=GB2312 "%>
<%@   page   import= "tom.jiafei.Test "%>
<html>
<body>
<font   size=2>
<jsp:useBean   id= "test "class= "tom.jiafei.Test "scope= "session ">
<br> 请选择试题:
<form   action= " "method= "post "name=form1>
<Select   name= "fileName "value= "A.txt ">
<Option   value= "A.txt "> A.txt
<Option   value= "B.txt "> B.txt
<Option   value= "C.txt "> C.txt
</Select>
<input   type=submit   value= "确定 "name= "sub ">
</form>


<jsp:setProperty   name= "test "   property= "fileName "param= "fileName "/>
<br> 试题内容如下:
<br> <jsp:getProperty   name= "test "   property= "testContent "/> <br>


<form   action= " "method= "post "   name=form2>
在文本框中输入全部问题的答案,答案之间不允许有空格:
<br> <input   type=text   name= "selection "size=80>
<input   type= "submit "   value= "提交 ">
</form>
<jsp:setProperty   name= "test "property= "selection "param= "selection "/>
<br> 试题的正确答案:
<jsp:getProperty   name= "test "property= "correctAnswer "/>
<br> 您提交的答案:
<jsp:getProperty   name= "test "Property= "selection "/>
<br> 您的分数:
<jsp:getProperty   name= "test "Property= "score "/>

</jsp:useBean>

</font>
</body>
</html>


------解决方案--------------------
<br/> 试题的正确答案:
<jsp:getProperty name= "test "property= "correctAnswer "/>
<br/> 您提交的答案:
<jsp:getProperty name= "test "Property= "selection "/>
<br/> 您的分数:
<jsp:getProperty name= "test "Property= "score "/>

property 前加空格试试 property 首字母改小写试试

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有