注册 登录
编程论坛 J2EE论坛

各位大侠谁能帮我解决一下JSP里下标的问题吗!!进来看一下!

xtwxfxk 发布于 2005-11-07 23:36, 858 次点击

怎么我写的JSP都人不出下标。
像这样的问题:
<html>
<head><title>powers of 2</title></head>
<body>
<center>
<h2>Behole The Powers Of2<h2>
</center>
<table border="2" align="center">
<th>Exponent</th><th>2~Exponent</th>
<% for(int i=0;i<10;i++) %>
<tr><td><%=i %></td>
<td><%=Math.pow(2,i) %></td>
</tr>
<% //end for loop %>
</table>
</body>
</html>
老是有这样的错误:
Note: sun.tools.javac.Main has been deprecated.
/PowerOf2.jsp:10: Undefined variable: i
out.print((i ));
^
/PowerOf2.jsp:11: Undefined variable: i
out.print((Math.pow(2,i) ));
^
2 errors, 1 warning

大侠们!!谁能帮一下忙啊!!拜托!!我都不知道为什么会认不出"i"能不能跟我说一下错在那里!

2 回复
#2
疯子java2005-11-08 15:34
看错误提示
你的i没有定义
<% for(int i=0;i<10;i++) %>
<tr><td><%=i %></td>
<td><%=Math.pow(2,i) %></td>
</tr>
<% //end for loop %>
自己好好看看是不是少了什么东西
#3
zhai26511732005-11-20 10:36
爱磨能作
1