struts2一直无法获得jsp传值,原来是extends写成了abstract

博客讲述了在使用Struts2时遇到的两个常见问题及解决办法。首先,由于将`extends`误写为`abstract`导致无法从JSP获取值。其次,用户登录后Action跳转页面失败,原因是URL大小写不敏感导致的找不到action或result。最后,解决了一个关于jsp提交时因未保存相关对象引发的错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、struts2一直无法获得jsp传值,原来是extends写成了abstract

万马奔腾。。。

2、用户登陆成功后Action跳转页面Could not find action or result

<action name="user_*" class="com.awf.crm.web.action.UserAction" method="{1}">
	<result name="REGIST">/regist.jsp</result>
	<result name="SUCCESS">/index.jsp</result>
</action>

改为

<action name="user_*" class="com.awf.crm.web.action.UserAction" method="{1}">
	<result name="regist">/regist.jsp</result>
	<result name="success">/index.jsp</result>
</action>

就可以成功跳转了

草泥马,居然是大小写的问题,难道 result只认小写?

3、jsp提交带下拉空间的页面提示object references an unsaved transient instance - save the transient instance before flushing

22:20:35.150 [http-nio-8080-exec-6] ERROR org.hibernate.internal.SessionImpl - HHH000346: 
Error during managed flush [object references an unsaved transient instance - save the 
transient instance before flushing: com.awf.crm.domain.BaseDict]

这是因为下拉数据设计数据字典,存在一对多的对象映射配置,在Action中只保存了Customer信息,没有保存basedict对象导致。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值