Exception occurred during processing request: null

本文探讨了在Struts+Spring框架中利用Hibernate进行数据库操作时遇到的对象空异常问题,详细解释了原因在于action类中未正确获取用户对象,导致无法从表单数据中提取信息。通过实例分析,展示了如何正确处理用户登录过程中的数据获取问题。

Hibernate: 
    select
        user0_.id as id1_0_,
        user0_.username as username2_0_,
        user0_.userpwd as userpwd3_0_,
        user0_.note as note4_0_ 
    from
        User user0_ 
    where
        user0_.username=? 

        and user0_.userpwd=?

2015-4-3 14:36:25 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Exception occurred during processing request: null
java.lang.NullPointerException
at dxm.com.action.UserAction.
login(UserAction.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)


从执行输出可以看出 hibernate部分执行了,却报对象空,具体原因是 在action类中,user 对象的get方法注掉了,就就相当于user只是申明了。 对象没法从form 中提交的数据获数据。

ok。


有一点为明白,我的意思是struts+spring框架建项目,为啥还有什么用到hibernate。待发现

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值