Struts + Spring + Hibernate to streamline the preparation of [file]

1.web.xml

<? 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
分类:Java 时间:2010-08-04 人气:158
分享到:
blog comments powered by Disqus

相关文章

  • Jsp / Servlet Chapter 9 review notes ----- custom tag JSP Standard Tag Library and 2010-10-26

    Tag Library: Reason: In the development of JSP, MVC design pattern in the standard, I hope as much as possible not to appear Scriplet (< %....%>), Provided in the JSP tag library called the code, this code can solve the JSP code appears Scriplet sit

  • 关于JSP配置文件web.xml加载顺序详解 2014-04-03

    本篇文章小编为大家介绍,关于JSP配置文件web.xml加载顺序详解.需要的朋友参考下 一. 1.启动一个WEB项目的时候,WEB容器会去读取它的配置文件web.xml,读取<context-param>和<listener>两个结点. 2.紧急着,容创建一个ServletContext(servlet上下文),这个web项目的所有部分都将共享这个上下文. 3.容器将<context-param>转换为键值对,并交给servletContext. 4.容器创建<l

  • java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL 2010-03-25

    Always start Tomcat deployment reported Error listenerStart wrong. Problem web.xml In org.springframework.web.context.ContextLoaderListener the listener could not be loaded Potential solutions for a: WEB-INF \ lib \ directory, the more a hibernate-an

  • javax.servlet.ServletException: java.lang.NoSuchMethodError: javax.servlet.jsp.J 2009-08-13

    javax.servlet.ServletException: java.lang.NoSuchMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext (Ljavax / servlet / ServletContext;) Ljavax / servlet / jsp / JspApplicationContext The problem occurs because of WEB project WEB-INF \

  • Solve the java web container can not find the DTD xml parsing problem 2011-04-28

    Project created a dtd file on the tomcat webapp class directory, xml also located in the class directory, xml to dtd dtd reference to the file name directly. But parsing is not taken according to the relative path to find xml dtd file, but in the imp

  • JSP中web.xml文件的作用及基本配置 2013-12-01

    一个Java Web中完全可以没有web.xml文件,也就是说,web.xml文件并不是Java Web工程必须的. 要想回答上面的问题,得先了解web.xml文件使用来干什么的,web.xml文件是用来配置:欢迎页.servlet.filter等的,当你的web工程没用到这些时,你就可以不用web.xml文件来配置你的web工程. 那么web.xml能做的所有事情都有那些? 其实,web.xml的模式(Schema)文件中定义了多少种标签元素,web.xml中就可以出现它的模式文件所定义的标签

  • web.xml in the load-on-startup tag meaning and application of struts jstl 2009-09-10

    Among the servlet configuration ,<load-on-startup>5</load-on-startup> Mean : Tag container is in the started loading this servlet. Where a value of 0 or greater than 0 Represents a container when the application starts the load servlet: When i

  • The absolute uri: http://java.sun.com/jstl/core_rt cannot be resolved in error 2010-05-30

    Quote About The absolute uri: http://java.sun.com/jstl/core_rt cannot be resolved in either web.xml or the jar files deployed with this application to solve! HTTP Status 500 - --------------------------------------------------------------------------

  • Problems in jboss6: BossXBRuntimeException: {http://java.sun.c/j2ee} name not found as 2010-11-10

    Recently deployed with the old jboss6 application, problems encountered and resolved it, and now it records, to facilitate future search. First, the deployment of jsp2.0 jboss6 application problems: org.jboss.xb.binding.JBossXBRuntimeException: {http

  • JSP+XML构架网站的实例 2014-01-07

    XML(可扩展标记语言)看起来可能像某种W3C标准--现在没有什么实际影响,即使以后能派上用场,也是很久以后的事.但实际上,它现在已经得到了应用.所以,不要等到XML已被加进了你最喜爱的HTML编辑器中才开始使用它.它现在就可以解决各种内部问题和B2B系统问题. 在Sparks.com,我们使用XML来标准化从Java对象到HTML数据显示等不同系统之间的数据表示. 特别需要指出的是,我们发现,只要以非常基本的XML结构来实现标准化,就可以更容易地共享和操作数据.在这一过程中,我们发现了使用XM

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.447 (s). 12 q(s)