Topic: 求助..关于JSP

  Print this page

1.求助..关于JSP Copy to clipboard
Posted by: 漫天寻你
Posted on: 2005-03-02 12:13

环境:j2sdk1.4.0+Apache2+resin-2.1.9
测试<%out.print("我爱jsp!");%>通过;

但这个jsp却报错:
文件名:test3.jsp
源代码:
<html>
<center>
<hl>TABLE</hl>
<form method=POST action=test3.jsp>
table width(<16)=<input type=TEXT name=WIDTH vaule="15" size=2>,
table Height(<16)=<input type=TEXT name=HEIGHT vaule="5" size=2>.
<input type=submit value="do it">
</form>
<hr>
<% String w=request.getParameter("WIDTH");
String h=request.getParameter("HEIGHT");
if(w==null)w="5";
if(h==null)w="15";
int width=Integer.parseInt(w);
int height=Integer.parseInt(h);
if(width>15)width=15;
if(width<0)width=0;
if(height>15)height=15;
if(height<0)height=0;
String[] colorArray={"00","11","22","33","44","55","66","77","88","99","AA","BB","CC","DD","EE","FF"}; %>
<table border=0 cellpadding=0 cellspacing=0>
<% for(int y=0;y<=height;y++){ %>
<tr>
<%for(int x=0;x<width;x++){
String bgColor="AA"+colorArray[y]+colorArray[x];%>
<td bgcolor=<%=bgColor%>>
(<%=x%>,<%=y%>)
</td>
<%}%>
</tr>
<%}%>
</table>
<hr>
</center>
</html>

报错为:
500 Servlet Exception
java.lang.NumberFormatException: null
  at java.lang.Integer.parseInt(Integer.java:394)
  at java.lang.Integer.parseInt(Integer.java:476)
  at _test3__jsp._jspService(/test3.jsp:15)
  at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
  at com.caucho.jsp.Page.subservice(Page.java:506)
  at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
  at com.caucho.server.http.Invocation.service(Invocation.java:315)
  at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
  at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:344)
  at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
  at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
  at java.lang.Thread.run(Thread.java:536)

--------------------------------------------------------------------------------
Resin 2.1.9 (built Tue Apr 15 14:28:40 PDT 2003)

请各位高手给我看看..可能是什么地方错了..
是不是环境有问题?

2.Re:求助..关于JSP [Re: 漫天寻你] Copy to clipboard
Posted by: qupd
Posted on: 2005-03-02 20:23

if(h==null) w="15";
~~~

3.Re:求助..关于JSP [Re: 漫天寻你] Copy to clipboard
Posted by: 漫天寻你
Posted on: 2005-03-02 20:36

非常感谢你...
我找了N次都没找出来...

再次感谢


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923