spring2.5注释的不支持

[size=large][b]1.spring2.5注释的不支持似乎不支持ActionForm的pojo属性的注释绑定[/b][/size]做了通讯管理,出现了
Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Invalid argument looking up property: "address.addName" of bean: "org.apache.struts.tagli


在jsp中使用<html:text>:
<html:text property="address.addName"/>


没有错啊,actionForm确实有address对象,该对象也有addName属性
ActionForm:
public class AddressForm extends QueryConditionForm {

//set pojo
@Resource(name="address")
private Address address;
.....


这是个隐含其它异常的异常,光看异常提示,是解决不了问题的
错误提示,找不到bean.property属性实际是个假像,实际上在Spring2.5 IOC中由于采用了构造和绑定bean的注释处理,在action中处理时
address 是个延迟加载对象,照常赋值,ActionForm 的 addressForm 的 address属性没有被初始化,所以会出现上述错误
解决办法是,将bean放入formBean之前,先将其初始化.
public class AddressForm extends QueryConditionForm {

//set pojo
private Address address = new Address();
.....




有些痛苦,spring2.5不支持这样写。
其实在开发中遇到类似问题。

[size=large][u][b]2.spring2.5注释的不支持似乎不支持Servlet使用的注释绑定[/b][/u][/size]我的小组成员使用了servlet请求,也使用了spring2.5的注释技术:但在dao层出现了问题,很明显读取不到数据库的sqlMapClient(使用了ibatis技术的dataSource)。
郁闷之余,还得解决spring不支持特性;
ApplicationContext ctx =   
new ClassPathXmlApplicationContext(locations);
fileDiskDao = (FileDiskDao)ctx.getBean("fileDiskDao");
FileDisk fd = new FileDisk();
fd.setFileId(1);
fd.setFileName("aaa");
fd.setFileType(0);
fd.setMaker(1);
fd.setMakerDate(new Date());
fd.setParent(0);
fd.setPath("0");
fd.setFileLength("200");

fileDiskDao.insertFile(fd);


呵呵,不知道大家是否遇到同样的问题,友们又是如何解决的呢
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值