- 浏览: 1208171 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (718)
- HTML (13)
- JS基础 (23)
- JS应用 (40)
- AJAX (6)
- JSP相关 (12)
- JAVA基础 (52)
- JAVA应用 (74)
- APPLET (11)
- SWING\RCP (2)
- JAVA反射 (6)
- 设计模式 (26)
- 数据库设计 (20)
- Struts (35)
- Struts2 (12)
- Spring (22)
- Hibernate (45)
- Ibatis (18)
- mybatis (3)
- SSH (8)
- UML (5)
- WebService (3)
- XML (16)
- Log4j (7)
- WEB容器 (26)
- 数据结构 (36)
- Linux (34)
- Ruby on Rails (1)
- 其它技术 (27)
- IDE配置 (15)
- 项目实战 (2)
- Oracle (69)
- JAVA报表 (7)
- Android学习 (2)
- 博客链接 (1)
- 网络基础 (1)
- WEB集群 (1)
- .Net开发 (11)
- PB (4)
- 系统构建 (15)
最新评论
-
jnjeC:
牛逼啊哥们,讲得太好了
Maven仓库理解、如何引入本地包、Maven多种方式打可执行jar包 -
九尾狐的yi巴:
很好 感谢!
Itext中文处理(更新版) -
luweifeng1983:
有用的,重启一下嘛。
设置eclipse外部修改文件后自动刷新 -
Master-Gao:
设置了也不管用,怎么破呢?
设置eclipse外部修改文件后自动刷新 -
aigo_h:
锋子还有时间写博客,还是很闲哈!
Add directory entries问题
程序由JDK1.3升级到JDK1.6的时候,使用ANT预编译JSP时提示:
The value for the useBean class attribute is invalid ,
The value for the useBean class attribute java.lang.Integer is invalid.
The value for the useBean class attribute java.util.List is invalid
是因为在JSP中使用了代码:
<jsp:useBean id="ShowCharge" class="java.lang.Boolean" scope="request"/>
可能是JDK版本问题导致编译的时候找不到Boolean类。
怎么办呢?
在JSP页面:<jsp:useBean id="ShowCharge" class="java.lang.Boolean" scope="request"/>
会显示错误信息:The constructor Boolean() is undefined即没有对应的构造函数
实际上代码<jsp:useBean id="ShowCharge" class="java.lang.Boolean" scope="request"/>
等价于:
Boolean ShowCharge = (Boolean)request.getAttribute("ShowCharge");
if(ShowCharge == null){
Boolean ShowCharge = new Boolean();
request.setAttribute("ShowCharge",ShowCharge);
}
那么JDK1.6中是没有Boolean()构造函数的,所以会报错。。。。;
以下相关链接对这个问题进行了分析,很不错的。
查找以下链接及相关:
http://www.blogjava.net/bluesky/archive/2005/12/05/22600.html
http://www.cnblogs.com/feiweiwei/archive/2007/12/05/984484.html
引用:--
可见错误可能的原因包括:
1. 在编译 JSP 时(不是运行时),指定的 Bean 类没找到
2. Bean 虽然找到了,但是它不是 public 的,或者找到的 class 文件是 interface 或抽象类
3. Bean 类中没有 public 的默认构建函数
对于
The value for the useBean class attribute is invalid ,
解决方法,用等价代码去替换如
将:<jsp:useBean id="ShowCharge" class="java.lang.Boolean" scope="request"/>
替换成:
Boolean ShowCharge = (Boolean)request.getAttribute("ShowCharge");
if(ShowCharge == null){
Boolean ShowCharge = new Boolean(false
);//注意这里换成带参数的构造方法
request.setAttribute("ShowCharge",ShowCharge);
}
对于
The value for the useBean class attribute java.lang.Integer is invalid.
解决方法,用等价代码去替换如
将:<jsp:useBean id="MaxDocDispIdx " class="java.lang.Integer" scope="request"/>
替换成:
Integer MaxDocDispIdx = (Integer)request.getAttribute("MaxDocDispIdx");
if(MaxDocDispIdx == null){
MaxDocDispIdx = new Integer(0);
request.setAttribute("MaxDocDispIdx",MaxDocDispIdx);
}
对于
The value for the useBean class attribute java.util.List is invalid
解决方法是将:
<jsp:useBean id="DocBeanList" class="java.util.List" scope="session" />
换成
<jsp:useBean id="DocBeanList" class="java.util.ArrayList" scope="session" />
关于The value for the useBean class attribute java.util.List is invalid这个问题可参见:
http://www.coderanch.com/t/286029/JSP/java/error-value-useBean-class-attribute
经过测试发现另一种方法可以实现:
如:<jsp:useBean id="ShowCharge" class="java.lang.Boolean" scope="request"/>
改成<jsp:useBean id="ShowCharge" type="java.lang.Boolean" scope="request"/>
即将class 改成type.对以上Integer,List类型都可以。
具体原因待查
发表评论
-
JAVA短信发送及JAVA发送http请求与处理
2016-06-22 14:34 520JAVA发送HTTP请求与处理参考: http://ww ... -
Java Zip应用
2016-06-22 14:30 547应用系统中使用jdk原生 ... -
模拟tomcat进行http请求及响应处理:BufferedReader类的readLine在socket网络编程应用时发生阻塞
2016-05-11 15:04 1664最近写一个简单的程序模拟tomcat进行http请求及响应 ... -
Castor-xml映射出现节点重复问题解决
2015-08-13 16:24 1187最近在使用Castor-xml生成XML时发现生成的格式不 ... -
Add directory entries问题
2014-08-05 10:24 1842用spring注解的项目,eclipse可以运行,打成jar ... -
BeanUtils.copyProperties与PropertyUtils.copyProperties用法及区别
2013-01-25 16:21 857http://www.cnblogs.com/fayf/ar ... -
java.net.BindException: Cannot assign requested address
2012-06-13 14:10 868转:http://wgkgood.blog.51cto ... -
Duplicate name in Manifest: Depends-On
2012-06-13 13:13 1613解决方法:http://ww2.sjc.edu/faculty ... -
java tree
2011-11-16 02:01 1266import java.util.ArrayList; im ... -
jacob操作word和excel
2011-07-28 17:00 872http://danadler.com/jacob/ -
获得PrepareStatement 的最终执行语句
2011-07-04 10:07 984方法一:http://www.blogjava.net/ ... -
Non-terminating decimal expansion; no exact representable decimal result
2011-06-24 16:03 2580由于需要处理精度比较高的浮点数,所以弃用double类型,改用 ... -
JXLS应用示例
2011-06-03 01:41 3422JXLS在循环的记录前加序号: <jx:f ... -
月份加减方法处理
2011-06-03 00:52 896private static String monthAdd ... -
JAVA 5.0 后 自带监控工具 jps、jinfo、jstat、jma
2011-05-12 16:25 1220最近有个客户要进行WebLogic性能调优,但因为他们没有性能 ... -
定时器的实现、java定时器介绍与Spring中定时器的配置
2011-04-28 15:05 25091定时器的作用 在实际的开发中,如果项目中需要定时执行或者需 ... -
ClientAbortException,Connection reset by peer: socket write error
2011-03-07 11:24 6036extremetable导出excel,弹出一个下载窗口,这 ... -
java 调ireport (javaBean数据源)保存服务器 生成word
2011-02-24 14:40 1523package com.ztesoft.bidding.con ... -
JAVA包生成EXE应用实例
2011-01-06 15:35 1007相关文章:http://blog.csdn.net/fresh ... -
RMI客户端调用远程服务器方法-远程方法调用
2010-12-27 16:45 2717RMI软件下载:http://www.genady.net/r ...
相关推荐
科技企业信息管理 ...The value for the useBean class attribute MD5.MD5 is invalid 猜测的话 useBean这个BEAN你没定义 自然他的属性MD5.MD5也就不存在了`` 好好看看你的WEB.XML等配置文件是不是少写了什么
This package is imported in the jsp page so that the Date class and its properties can accessed in the JSP page. If- Else Ladder A ladder means a vertical set of steps. It is a computer generated ...
JSP useBean连接 Access 数据库,不使用数据源
jsp设计事例jsp usebean session
jsp+servlet+usebean实现MVC
这是一个我自己用JSP+USEBEAN写的系统,
usebean.jsp
<jsp:useBean id="updateBean" scope="page" class="guest.guest" /> <HTML> <BODY BGCOLOR="white"> <H1>jspSmartUpload : Sample 2</H1> <HR> String name = (String) session.getValue(...
<input name="lrcUp" type="button" class="btn_grey" value="上传文件" disabled="none" onClick="if(this.form.fileURL.value!=''){window.open('upLrcFile.jsp?fileName='+this.form.fileURL.value,'','width=...
<jsp:useBean id="rd" class="songyc.ReadFile" scope="application"> <jsp:setProperty name="rd" property="path" value="d:/testsongyc.txt" /> </jsp:useBean> HashMap hm=new HashMap(); Double db=null;...
未完成的个人留言板,喜欢的接下去吧。本来是展示给最爱的师父的,可惜错过了,无限的遗憾,期待未完待续的结局 ,赫赫
<jsp:useBean id="connection"class="com.esri.aims.mtier.io.ConnectionProxy"scope="page"/><jsp:useBean id="map"class="com.esri.aims.mtier.model.map.Map"scope="page"/> connection.setConnectionType("tcp...
对常见中文乱码问题进行了详细介绍和解释,希望能给大家以帮助。
NULL 博文链接:https://zywang.iteye.com/blog/412922
<jsp:useBean id="query" class="Bean.QueryBean" scope="session"> *"/> </jsp:useBean> request.setCharacterEncoding("UTF-8"); String name=request.getParameter("username"); String password=request....
<jsp:useBean id="jdbc" class="com.Jdbc_conn" scope="page" /> (); java.util.Date todayime = new java.util.Date(today); SimpleDateFormat formatter = new SimpleDateFormat("yyMMddHHmmss"); String ...
– 数据分页显示 – JDBC 2.0:ODBC 通过jdbc:odbc可以实现Jsp对数据库的操作,在这个例子中我将数据库的连接写在了一个JavaBean中,可以实现重复使用 pagetest.jsp文件: <!...%...jsp:useBean id=
public class SpringTest { public static void main(String[] args) { //创建spring的ApplicationContext ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); //...
详细介绍了jsp标准动作各个标记及其属性的使用方法。
<jsp:useBean id="db" class="dbBean.DBBean" scope="session"/> <jsp:setProperty name="db" property="connStr" value="jdbc:odbc:vote"/> <html><body> 您最喜爱的奥斯卡获奖影片是: ResultSet rs=db....