<% int score=0; %>你应该定义在循环和if条件等的外面
<%! int score=0; %>定义插入到servlet类的主体中的方法和变量
<%! int score=0; %>定义插入到servlet类的主体中的方法和变量
解决方案 »
- The value for the useBean class attribute test.First is invalid
- 菜鸟求答,各位请答
- 请教高手怎么用java实现在EXCEL中添加下拉列表
- 使用JSP自动生成图片附加码,为什么只显示了底色,而随机数字不显示?
- jasperreport 打印打及印预览功能如何实现???
- Tomcat5.5 打war包后项目无法正确执行查询
- 在Navicat for MYSQl运行sql文件错误
- 网页获取数据写入数据库 在数据库显示乱码 在哪儿怎么设置编码格式
- 汉化问题,紧急求救!!!
- 今天下班前结贴给分◆◇◆数字转换大写◆◇◆◇◆
- 怎么回事,我发的所有帖子都不见了?
- 如何设置OUTLOOK 如何设置OUTLOOK 在线急 在线急 在线急
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<DIV ALIGN="RIGHT">
<FONT SIZE="-1"><A HREF="/developer/Quizzes/index.html">Quizzes
Index</A></FONT></DIV>
<H2 ALIGN="RIGHT"><FONT COLOR="#FFFFFFF">JSP Professional, Chapter 12 Quiz
Answers</FONT></H2>
<H4 ALIGN="RIGHT"><EM>by Dan Malks</EM></H4>
<BR><BR>
<TABLE BORDER="0" CELLSPACING="8" CELLPADDING="2" <TR><TD>
<FONT FACE="Verdana, Arial, Helvetica, sans-serif"><%-- Page directive that applies to entire page. --%>
<%@ page language="java" %><%-- Identifies bean as "worker" and tells the page where to locate the bean. --%>
<jsp:useBean id="worker" class="jdc.quiz.QuizResponses" scope="request" /><%-- Set bean properties with a wildcard. --%>
<jsp:setProperty name="worker" property="*" />
<%-- Scoring --%><%-- Variable declaration in code scriptlet -->
<!--********************************************-->
<% int score=0; %><!-- Quiz Questions --><!-- Question 1 --><TR><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">1.</FONT></TD><%-- The method getOne() was set up in the bean with the id "worker" --%>
<%-- All Java code is enclosed in <% %>, leaving HTML to be easily --%>
<%-- changed or updated. --%><% if((worker.getOne() != null) && ((worker.getOne()).equals("D"))) { score ++; %><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif"> <B>D</B>
is correct!</FONT></TD>
<% } else if (worker.getOne() != null) { %>
<TD VALIGN="TOP"><FONT COLOR=red><jsp:getProperty name="worker" property="one" />
is incorrect!</FONT></TD><% } else { %><TD VALIGN="TOP">Blank <FONT COLOR=red>X</FONT></TD><% } %><TD VALIGN="TOP"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
Every JavaServer Pages<SUP><FONT SIZE="-2">TM</FONT></SUP>
(JSP)<SUP><FONT SIZE="-2">TM</FONT></SUP>source page is compiled into
a servlet before it is executed at runtime.</A><BR><BR></FONT></TD></TR>
这样,你换个名字
int count=0;
<!--********************************************-->
<% int score=0; %>