spring和ssh整合的一些问题

1.<context:component-scan base-package=“cn.itcast”></context:component-scan>要先扫描包,然后在配置对象,不然找不到,不生成对象,报空指针异常

2. <!-- 开启aop操作(扫描) -->
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
:要在配置方法之前

3.HTTP Status 500 - Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove ‘readOnly’ marker from transaction definition.: 事务只读,要配置事务@transcational

4.HTTP Status 500 - Unable to instantiate Action, customerAction, defined for ‘customer_toAddPage’ in namespace '/'Error creating bean with name ‘customerAction’ defined in class path resource [customer.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type [com.sun.proxy.$Proxy33 implementing :
我是把extends ActionSupport写在了service类上

5.不能把jsp标签和struts标签搞混了

6.普普通通404错误:dao接口未被实现,bean.xml中却配置了

7.HTTP Status 500 - An exception occurred processing JSP page + no session问题:因为在hibernate语句结束后,session会关闭
解决方案:认session延迟关闭,在action结束后关闭。在过滤器filter前面,配置如下

<filter>
	<filter-name>openSessionInViewFilter</filter-name>
	<filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
	<filter-name>openSessionInViewFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>

8.Line: 245 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:245:-1
web.xml没有配置

<context-param>
  		<param-name>contextConfigLocation</param-name>
  		<param-value>classpath:bean.xml</param-value>
  	</context-param>
  	<listener>
    	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

9.HTTP Status 500 - The given object has a null identifier: …; nested exception is org.hibernate.TransientObjectException: The given object has a null identifier: …
:你要把你的更新的实例的主键传过去,主键上传空了,当你update数据库时主键不能空

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值