Struts + Spring + Hibernate to streamline the preparation of [file]
Advertisements
<? Xml version = "1.0" encoding = "UTF-8"?>
<Web-app xmlns = "http://java.sun.com/xml/ns/j2ee"
xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" version = "2.4"
xsi: schemaLocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name> contextConfigLocation </ param-name>
<param-value> / WEB-INF/applicationContext *. xml </ param-value>
</ Context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</ Listener-class>
</ Listener>
<servlet>
<servlet-name> action </ servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</ Servlet-class>
<init-param>
<param-name> config </ param-name>
<param-value>
/ WEB-INF/struts-config.xml, / WEB-INF/struts-config-form.xml, / WEB-INF/struts-config-action.xml
</ Param-value>
</ Init-param>
<init-param>
<param-name> debug </ param-name>
<param-value> 3 </ param-value>
</ Init-param>
<init-param>
<param-name> detail </ param-name>
<param-value> 3 </ param-value>
</ Init-param>
<load-on-startup> 0 </ load-on-startup>
</ Servlet>
<servlet-mapping>
<servlet-name> action </ servlet-name>
<url-pattern> *. do </ url-pattern>
</ Servlet-mapping>
<session-config>
<session-timeout> 120 </ session-timeout>
</ Session-config>
<! - The Usual Welcome File List ->
<welcome-file-list>
<welcome-file> login.jsp </ welcome-file>
</ Welcome-file-list>
<! - Tag Library Descriptors ->
<jsp-config>
<taglib>
<taglib-uri> / WEB-INF/tld/struts-bean.tld </ taglib-uri>
<taglib-location>
/ WEB-INF/tld/struts-bean.tld
</ Taglib-location>
</ Taglib>
<taglib>
<taglib-uri> / WEB-INF/tld/struts-html.tld </ taglib-uri>
<taglib-location>
/ WEB-INF/tld/struts-html.tld
</ Taglib-location>
</ Taglib>
<taglib>
<taglib-uri> / WEB-INF/tld/struts-logic.tld </ taglib-uri>
<taglib-location>
/ WEB-INF/tld/struts-logic.tld
</ Taglib-location>
</ Taglib>
<taglib>
<taglib-uri> / WEB-INF/tld/struts-nested.tld </ taglib-uri>
<taglib-location>
/ WEB-INF/tld/struts-nested.tld
</ Taglib-location>
</ Taglib>
<taglib>
<taglib-uri> / WEB-INF/tld/struts-template.tld </ taglib-uri>
<taglib-location>
/ WEB-INF/tld/struts-template.tld
</ Taglib-location>
</ Taglib>
<taglib>
<taglib-uri> / WEB-INF/tld/struts-tiles.tld </ taglib-uri>
<taglib-location>
/ WEB-INF/tld/struts-tiles.tld
</ Taglib-location>
</ Taglib>
</ Jsp-config>
</ Web-app>
2.applicationContext-persistence.xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE beans PUBLIC "- / / SPRING / / DTD BEAN / / EN"
"Http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<! - Configure Data Source ->
<Bean
destroy-method = "close">
<property name="driverClassName">
<value> oracle.jdbc.driver.OracleDriver </ value>
</ Property>
<property name="url">
<value> jdbc: oracle: thin: @ localhost: 1521: ora9i </ value>
</ Property>
<property name="username">
<value> tom </ value>
</ Property>
<property name="password">
<value> tom </ value>
</ Property>
</ Bean>
<! - Configure Hibernate ->
<Bean
>
<property name="dataSource">
<ref local="dataSource" />
</ Property>
<property name="mappingResources">
<list>
<value> com / example / entity / User.hbm.xml </ value>
</ List>
</ Property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</ Prop>
<prop key="hibernate.show_sql"> true </ prop>
</ Props>
</ Property>
</ Bean>
<! - Configure Services ->
<Bean
>
<property name="sessionFactory">
<ref local="sessionFactory" />
</ Property>
</ Bean>
<Bean
>
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="find*"> PROPAGATION_REQUIRED, readOnly </ prop>
<prop key="save*"> PROPAGATION_REQUIRED </ prop>
<prop key="update*"> PROPAGATION_REQUIRED </ prop>
<prop key="delete*"> PROPAGATION_REQUIRED </ prop>
</ Props>
</ Property>
</ Bean>
<Bean
>
<property name="proxyTargetClass">
<value> true </ value>
</ Property>
<property name="beanNames">
<list>
<value> * Service </ value>
</ List>
</ Property>
<property name="interceptorNames">
<list>
<value> transactionInterceptor </ value>
</ List>
</ Property>
</ Bean>
</ Beans>
3.applicationContext-action.xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE beans PUBLIC "- / / SPRING / / DTD BEAN 2.0 / / EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<! - Example ->
<bean name="/login">
<property name="userService">
<ref bean="userService" />
</ Property>
</ Bean>
</ Beans>
4.applicationContext-service.xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE beans PUBLIC "- / / SPRING / / DTD BEAN 2.0 / / EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<! - Example ->
<Bean
>
<property name="userDAO">
<ref bean="userDAO" />
</ Property>
</ Bean>
</ Beans>
5.applicationContext-dao.xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE beans PUBLIC "- / / SPRING / / DTD BEAN 2.0 / / EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<! - Example ->
<bean>
<property name="sessionFactory">
<ref bean="sessionFactory" />
</ Property>
</ Bean>
</ Beans>
6.struts-config.xml
&
struts2.0.14 + hibernate3.2 + spring2.5.6 + to ... | hibernate configuration file Xiangjie
- 21:49
- View (0)
- Comments (0)
- Category: Java
- Related Recommendation
Comment
Comment
Related Posts of Struts + Spring + Hibernate to streamline the preparation of [file]
-
Servlet brief introduction
Servlet brief introduction: Servlet is a small application server Are used to complete the B / S architecture, the client requests the response to treatment Platform independence, performance, able to run thread Servlet API for Servlet provides the s ...
-
Spring2.0 + hibernate3.1 + log4j + mysql demo
applicationContext.xml Non-attachment jar package, necessary friends can send an email to todd.liangt @ gmail.com
blog comments powered by Disqus












