struts 配置 error filter
struts配置
1:jar包
commons-fileupload-1.2.1.jar 、 commons-logging-1.0.4.jar 、 freemarker-2.3.15.jar 、 log4j-1.2.15.jar 、 ognl-2.7.3.jar 、 struts2-core-2.1.8.1.jar 、 xwork-core- 2.1.6.jar
2:struts.xml
3:web.xml
出错想想都需要哪些配置,挨个排查,这次的错误在于struts初始化了log4j,log4j.properties写错了!
hibernate
1:jar包
2:hibernate.cfg.xml 以及实体类
web.xml中无需配置
Spring
1.jar包
2.applicationContext.xml中
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
</bean>
<bean id="hibernateDaoSupport" abstract="true">
<property name="sessionFactory" ref="sessionFactory"></property>
<!-- <property name="hibernateLog" ref="hibernateLog"></property> -->
</bean>
<!-- sys start -->
<bean id="test" class="test.TestStrutsAction" parent="hibernateDaoSupport"/>
给hibernateDao注入huberbateDaoSupport 以及注入类的实例
3.web.xml
a:<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
b:<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-*.xml</param-value>
</context-param>
说明applicationContext.xml文件的位置
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
启动spring
SSH环境
猜你喜欢
转载自everlxq.iteye.com/blog/1894749
今日推荐
周排行