帮我解一下吧,我都郁闷了好几天了,找不出什么原因?

chen980347 2004-09-20 10:48:35
<%@ page language="java" contentTpye="text/html;charset=gb2312"%>
<%@ page info="a hello word example"%>
<html>
<head>
<title>理解JSP原理</title>
</head>
<body>
<center>
<h1>
<%
int times=Integer.parsetInt(request.getParameter("times"));
for(int i=0;i<times;i++)
{
out.println("hello world");
out.println("<br>");
}
%>
</h1>
</center>
</body>
</html>

在用jbulider编译时一直提示:没找到java.lang.Integer这个类呢?
且错误一直在int times=Integer.parsetInt(request.getParameter("times")); 这行上
不知道为什么?能说一下吗?
...全文
133 点赞 收藏 12
写回复
12 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
chen980347 2004-09-22
谢谢,这个问题解决了,大家帮我解决另一个吧,不好意思`-`…
http://community.csdn.net/Expert/topic/3388/3388762.xml?temp=.5028955(这个问题我问了好久没有解决)
回复
yu365 2004-09-22
没有取得times的值,是null,所以就报你上面的错误了
回复
wenlong1045 2004-09-22
同意 你应该有两个页面吧
request取得的应该是另一个页面输入的信息
回复
disizhishou 2004-09-22
明显request.getParameter("times")得到的是null嘛,编译器错误提示都这么明显了。
回复
gundam_king 2004-09-22
你自己先看看String a=request.getParameter("times")得到的是什么
回复
try{
int times=Integer.parsetInt(request.getParameter("times"));
}catch(Exception e){
e.printStackTrace();
}
回复
chen980347 2004-09-22
我按各位大虾说的做了,提示如下(用JBulider):
Apache Tomcat/4.0.6 - HTTP Status 500 - Internal Server Errortype Exception reportmessage Internal Server Errordescription The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.exception java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:394)
at java.lang.Integer.parseInt(Integer.java:476)
at org.apache.jsp.chen1$jsp._jspService(chen1$jsp.java:68)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
回复
july_typhoon 2004-09-20
parsetInt是笔误?parseInt()
回复
july_typhoon 2004-09-20
java.lang包里面的类是核心类,jvm会自动去找的。request.getParameter("times")得到的是啥东西?必须是整数型的字符串,如“1234”,而“12sd”就不行了。
回复
奇伢 2004-09-20
int times=Integer.parsetInt(request.getParameter("times"));
这句改为
int times=java.lang.Integer.parsetInt(request.getParameter("times"));
回复
guestman 2004-09-20
将这句:
<%@ page language="java" contentTpye="text/html;charset=gb2312"%>
改为
<%@ page language="java" contentType="text/html;charset=gb2312"%>

其中的contentTpye——》contentType

回复
benben980 2004-09-20
我更郁闷啊,提了半天问题都不在社区上显示!我是刚刚更菜的那个,帮忙回个把,拜托
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2004-09-20 10:48
社区公告
暂无公告