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数据库时主键不能空