| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 741 人关注过本帖
标题:一个JSP小问题(空指针)
只看楼主 加入收藏
xiaobohp
Rank: 1
等 级:新手上路
帖 子:64
专家分:0
注 册:2007-4-19
收藏
 问题点数:0 回复次数:3 
一个JSP小问题(空指针)

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.NumberFormatException: For input string: ""

root cause

java.lang.NumberFormatException: For input string: ""

note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server Platform Edition 9.0_01 logs.

//错误代码
<%@page contentType="text/html"%>
<%@page pageEncoding="GBK" import="model.*"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:useBean id="thing" scope="page" class="model.Things" />
<jsp:setProperty name="thing" property="*" />
<%
Catalog c = CatalogService.getCatalog(Integer.parseInt(request.getParameter("catalogID")));
CatalogService.addThing(c,thing);
//request.setAttribute("c",c)
%>
<jsp:forward page="ListThings.jsp?id=${c.ID}" />

搜索更多相关主题的帖子: 指针 JSP 
2007-11-11 19:02
a276202460
Rank: 2
等 级:新手上路
威 望:4
帖 子:392
专家分:1
注 册:2007-4-10
收藏
得分:0 
request.getParameter("catalogID")这里获取的catalogID你地址里有传过来的时候值错了

2007-11-11 20:52
glamey
Rank: 2
等 级:论坛游民
威 望:1
帖 子:57
专家分:17
注 册:2006-5-31
收藏
得分:0 
request.getParameter("catalogID")这个值获取的时候应该空了,所以你进行类型转换的时候出现了错误。
Catalog c = CatalogService.getCatalog(request.getParameter!=null?Integer.parseInt(request.getParameter("catalogID")):当等于空时候你要赋值);


锲而不舍。自信自强。
2007-11-12 10:03
xiaobohp
Rank: 1
等 级:新手上路
帖 子:64
专家分:0
注 册:2007-4-19
收藏
得分:0 
谢谢

坚持, 只因不原放弃.
2007-11-18 14:48
快速回复:一个JSP小问题(空指针)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011686 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved