`
xugq035
  • 浏览: 36036 次
社区版块
存档分类
最新评论

配置struts2.0.6+spring2.0.3+hibernane3备忘

    博客分类:
  • J2EE
阅读更多

花了2个小时终于配置好struts2.0.6+spring2.0.3+hibernane3,为自己庆祝一下,分享一下经验

一、struts2。

跟webwork配置基本一致,主要是struts2.properties和struts.xml 2个配置文件,我的struts2.properties如下配置:

struts2.properties
  1. struts.tag.altSyntax = true  
  2. struts.devMode = true  
  3.   
  4. ### These can be used to set the default HTTP and HTTPS  ports   
  5. struts.url.http.port = 80  
  6. #webwork.url.https.port = 443  
  7.   
  8. ### This can be used to set your locale and encoding scheme   
  9. struts.custom.i18n.resources=ApplicationResources  
  10. struts.locale=zh_CN  
  11. struts.i18n.encoding=utf-8   
  12.   
  13. # uses javax.servlet.context.tempdir by default   
  14. struts.multipart.parser=com.opensymphony.webwork.dispatcher.multipart.PellMultiPartRequest   
  15. #struts.multipart.saveDir=tmp  
  16. struts.multipart.saveDir=/tmp   
  17. struts.multipart.maxSize=512000000  
  18. struts.configuration.xml.reload=true  
  19.   
  20. struts.objectFactory = spring  

struts.xml 就是配置action了,由于设定了struts.objectFactory = spring,因此struts2会自动将action转为spring的bean,struts.xml可以直接配置我们的action路径,在action中我们只需要设置某个service文件的set方法即可调用事务管理bean。

struts.xml
  1. <!---->xml version="1.0" encoding="UTF-8" ?>  
  2. <!---->
  3.     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"   
  4.     "http://struts.apache.org/dtds/struts-2.0.dtd">  
  5.   
  6. <struts>  
  7.   
  8.     <include file="struts-default.xml" />  
  9.   
  10.     <package name="default" extends="struts-default">  
  11.         <default-interceptor-ref name="completeStack" />  
  12.   
  13.         <global-results>  
  14.             <result name="login" type="redirect">login!default.actionresult>  
  15.             <result name="unauthorized">unauthorized.jspresult>  
  16.         global-results>  
  17.            
  18.         <action name="login" class="com.baseframe.action.LoginAction">  
  19.             <result name="input">login.jspresult>  
  20.             <result name="success">main.jspresult>  
  21.             <result name="error">login.jspresult>  
  22.         action>  
  23.         <action name="logout" class="com.baseframe.action.LogoutAction">  
  24.             <result name="success">login.jspresult>  
  25.         action>  
  26.     package>  
  27.   
  28. struts>  

二、spring2。

添加dist下的3个spring包,因为不知道哪些包是必须的,把lib里的包都加了,去除jakarta-commons/commons-attributes-compiler.jar、j2ee/servlet-api.jar、j2ee/jsp-api.jar,然后建立配置文件,我分了三个文件:

主配置文件
  1. <!---->xml version="1.0" encoding="UTF-8"?>  
  2. <!---->
  3.     "http://www.springframework.org/dtd/spring-beans.dtd">  
  4. <beans>    
  5.     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">  
  6.         ...   
  7.     bean>  
  8.        
  9.     <bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">  
  10.         ...   
  11.     bean>  
  12.        
  13.     <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">  
  14.         <property name="dataSource" ref="dataSource"/>  
  15.         <property name="hibernateProperties">  
  16.             <ref bean="hibernateProperties"/>  
  17.         property>  
  18.         <property name="mappingResources">  
  19.             <list>  
  20.                 <value>com/baseframe/model/AppUser.hbm.xmlvalue>  
  21.                 <!---->  
  22.             list>  
  23.         property>  
  24.     bean>  
  25.        
  26.     <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">  
  27.         <property name="sessionFactory" ref="sessionFactory"/>  
  28.     bean>  
  29.        
  30.     <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">  
  31.         <property name="transactionManager" ref="transactionManager"/>  
  32.         <property name="transactionAttributes">  
  33.             <props>  
  34.                 <prop key="*">PROPAGATION_REQUIREDprop>  
  35.                 <prop key="amount*">PROPAGATION_REQUIRED,readOnlyprop>  
  36.                 <prop key="find*">PROPAGATION_REQUIRED,readOnlyprop>  
  37.             props>  
  38.         property>  
  39.     bean>    
  40.        
  41.     <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">  
  42.         <property name="beanNames">  
  43.             <value>*Servicevalue>  
  44.         property>  
  45.         <property name="interceptorNames">  
  46.             <list>  
  47.                 <value>transactionInterceptorvalue>  
  48.                 <!---->  
  49.             list>  
  50.         property>  
  51.     bean>  
  52.        
  53.     <bean class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">  
  54.         <property name="transactionInterceptor" ref="transactionInterceptor"/>  
  55.     bean>  
  56. beans>  
 
dao配置文件
  1. <!---->xml version="1.0" encoding="UTF-8"?>  
  2.   
  3. <!---->
  4.     "http://www.springframework.org/dtd/spring-beans.dtd">  
  5.   
  6. <beans default-autowire="byName">  
  7.        
  8.     <bean id="userDao" class="com.baseframe.dao.impl.UserDaoImpl"/>  
  9.        
  10. beans>  

 

service/manager配置 
  1. <!---->xml version="1.0" encoding="UTF-8"?>  
  2.   
  3. <!---->
  4.     "http://www.springframework.org/dtd/spring-beans.dtd">  
  5.   
  6. <beans default-autowire="byName">  
  7.        
  8.     <bean id="userService" class="com.baseframe.service.impl.UserServiceImpl"/>  
  9.        
  10. beans>  

 

三、web.xml

有一点很重要,struts的filter需要放在最底,不然action接收的中文可能会乱码,不知道是不是这个原因,反正配置了就没有乱码了,加上org.springframework.orm.hibernate3.support.OpenSessionInViewFilter就不用考虑hibernate的lazy问题了:

xml 代码
  1. <filter>  
  2.       <filter-name>encodingFilterfilter-name>  
  3.       <filter-class>org.springframework.web.filter.CharacterEncodingFilterfilter-class>  
  4.       <init-param>  
  5.           <param-name>encodingparam-name>  
  6.           <param-value>UTF-8param-value>  
  7.       init-param>  
  8.   filter>  
  9.   <filter-mapping>  
  10.       <filter-name>encodingFilterfilter-name>  
  11.       <url-pattern>/*url-pattern>  
  12.   filter-mapping>  
  13.  <filter>
      <filter-name>hibernateFilter</filter-name>
      <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
      </filter>
      <filter-mapping>
      <filter-name>hibernateFilter</filter-name>
      <url-pattern>/*</url-pattern>
      </filter-mapping>
      
  14.   <filter>  
  15.        extremetable的filter   
  16.   filter>  
  17.   <filter-mapping>  
  18.        extremetable的filter mapping   
  19.   filter-mapping>  
  20.   
  21.   <filter>  
  22.       <filter-name>struts2filter-name>  
  23.       <filter-class>org.apache.struts2.dispatcher.FilterDispatcherfilter-class>  
  24.   filter>  
  25.   <filter-mapping>  
  26.       <filter-name>struts2filter-name>  
  27.       <url-pattern>/*url-pattern>  
  28.   filter-mapping>  

 

如有错误,欢迎指正

分享到:
评论
9 楼 xugq035 2007-03-29  
<br/>
<strong>gcgan 写道:</strong><br/>
<div class='quote_div'>struts.xml
<div class='quote_div'><font>
<div class='dp-highlighter' style='width: 99%; height: 236px;'>
<div class='bar'> </div>
<ol class='dp-xml'>
    <li class='alt'><span><span class='tag'><!----><span class='tag-name'>xml</span><span> </span><span class='attribute'>version</span><span>=</span><span class='attribute-value'>"1.0"</span><span> </span><span class='attribute'>encoding</span><span>=</span><span class='attribute-value'>"UTF-8"</span><span> </span><span class='tag'>?&gt;</span><span>  </span></span> </span></li>
    <li class=''><span><!----></span></li>
    <li class='alt'><span>    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"   </span> </li>
    <li class=''><span>    "http://struts.apache.org/dtds/struts-2.0.dtd"</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class='alt'><span>  </span> </li>
    <li class=''><span/><span class='tag'>&lt;</span><span class='tag-name'>struts</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class='alt'><span>  </span> </li>
    <li class=''><span>    </span><span class='tag'>&lt;</span><span class='tag-name'>include</span><span> </span><span class='attribute'>file</span><span>=</span><span class='attribute-value'>"struts-default.xml"</span><span> </span><span class='tag'>/&gt;</span><span>  </span> </li>
    <li class='alt'><span>  </span> </li>
    <li class=''><span>    </span><span class='tag'>&lt;</span><span class='tag-name'>package</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"default"</span><span> </span><span class='attribute'>extends</span><span>=</span><span class='attribute-value'>"struts-default"</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class='alt'><span>        </span><span class='tag'>&lt;</span><span class='tag-name'>default-interceptor-ref</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"completeStack"</span><span> </span><span class='tag'>/&gt;</span><span>  </span> </li>
    <li class=''><span>  </span> </li>
    <li class='alt'><span>        </span><span class='tag'>&lt;</span><span class='tag-name'>global-results</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class=''><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"login"</span><span> </span><span class='attribute'>type</span><span>=</span><span class='attribute-value'>"redirect"</span><span class='tag'>&gt;</span><span>login!default.action</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"unauthorized"</span><span class='tag'>&gt;</span><span>unauthorized.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class=''><span>        </span><span class='tag'><span class='tag-name'>global-results</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>           </span> </li>
    <li class=''><span>        </span><span class='tag'>&lt;</span><span class='tag-name'>action</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"login"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"com.baseframe.action.LoginAction"</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class='alt'><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"input"</span><span class='tag'>&gt;</span><span>login.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class=''><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"success"</span><span class='tag'>&gt;</span><span>main.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"error"</span><span class='tag'>&gt;</span><span>login.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class=''><span>        </span><span class='tag'><span class='tag-name'>action</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>        </span><span class='tag'>&lt;</span><span class='tag-name'>action</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"logout"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"com.baseframe.action.LogoutAction"</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class=''><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"success"</span><span class='tag'>&gt;</span><span>login.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>        </span><span class='tag'><span class='tag-name'>action</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class=''><span>    </span><span class='tag'><span class='tag-name'>package</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>  </span> </li>
    <li class=''><span/><span class='tag'><span class='tag-name'>struts</span><span class='tag'>&gt;</span><span>  </span> </span></li>
</ol>
</div>
</font><br/>
</div>
&lt;action&gt;&lt;/action&gt;的class是用的类<font>如:<span class='attribute-value'>com.baseframe.action.LoginAction</span></font>,请问什么地方体现了struts+spring呢?<br/>
我觉得是不是应该用spring的bean来代替类呢?<br/>
</div>
<p>spring的bean应该在action中调用,在LoginAction中应该包含类似如下的代码:</p>
<p><font><font> private EmployeeService employeeService;<br/>
 public void setEmployeeService(EmployeeService employeeService) {<br/>
      this.employeeService = employeeService;<br/>
 }</font></font><br/>
</p>
<p>这个EmployeeService才是spring的bean<br/>
只要你再struts.properties文件中设定了<font>struts.objectFactory = spring,加入<font>struts2-spring-plugin-2.0.6.jar就可以了</font></font></p>
8 楼 gcgan 2007-03-29  
struts.xml
<div class='quote_div'><font>
<div class='dp-highlighter' style='width: 99%; height: 236px;'>
<div class='bar'> </div>
<ol class='dp-xml'>
    <li class='alt'><span><span class='tag'><!----><span class='tag-name'>xml</span><span> </span><span class='attribute'>version</span><span>=</span><span class='attribute-value'>"1.0"</span><span> </span><span class='attribute'>encoding</span><span>=</span><span class='attribute-value'>"UTF-8"</span><span> </span><span class='tag'>?&gt;</span><span>  </span></span> </span></li>
    <li class=''><span><!----></span></li>
    <li class='alt'><span>    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"   </span> </li>
    <li class=''><span>    "http://struts.apache.org/dtds/struts-2.0.dtd"</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class='alt'><span>  </span> </li>
    <li class=''><span/><span class='tag'>&lt;</span><span class='tag-name'>struts</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class='alt'><span>  </span> </li>
    <li class=''><span>    </span><span class='tag'>&lt;</span><span class='tag-name'>include</span><span> </span><span class='attribute'>file</span><span>=</span><span class='attribute-value'>"struts-default.xml"</span><span> </span><span class='tag'>/&gt;</span><span>  </span> </li>
    <li class='alt'><span>  </span> </li>
    <li class=''><span>    </span><span class='tag'>&lt;</span><span class='tag-name'>package</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"default"</span><span> </span><span class='attribute'>extends</span><span>=</span><span class='attribute-value'>"struts-default"</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class='alt'><span>        </span><span class='tag'>&lt;</span><span class='tag-name'>default-interceptor-ref</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"completeStack"</span><span> </span><span class='tag'>/&gt;</span><span>  </span> </li>
    <li class=''><span>  </span> </li>
    <li class='alt'><span>        </span><span class='tag'>&lt;</span><span class='tag-name'>global-results</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class=''><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"login"</span><span> </span><span class='attribute'>type</span><span>=</span><span class='attribute-value'>"redirect"</span><span class='tag'>&gt;</span><span>login!default.action</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"unauthorized"</span><span class='tag'>&gt;</span><span>unauthorized.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class=''><span>        </span><span class='tag'><span class='tag-name'>global-results</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>           </span> </li>
    <li class=''><span>        </span><span class='tag'>&lt;</span><span class='tag-name'>action</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"login"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"com.baseframe.action.LoginAction"</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class='alt'><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"input"</span><span class='tag'>&gt;</span><span>login.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class=''><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"success"</span><span class='tag'>&gt;</span><span>main.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"error"</span><span class='tag'>&gt;</span><span>login.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class=''><span>        </span><span class='tag'><span class='tag-name'>action</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>        </span><span class='tag'>&lt;</span><span class='tag-name'>action</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"logout"</span><span> </span><span class='attribute'>class</span><span>=</span><span class='attribute-value'>"com.baseframe.action.LogoutAction"</span><span class='tag'>&gt;</span><span>  </span> </li>
    <li class=''><span>            </span><span class='tag'>&lt;</span><span class='tag-name'>result</span><span> </span><span class='attribute'>name</span><span>=</span><span class='attribute-value'>"success"</span><span class='tag'>&gt;</span><span>login.jsp</span><span class='tag'><span class='tag-name'>result</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>        </span><span class='tag'><span class='tag-name'>action</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class=''><span>    </span><span class='tag'><span class='tag-name'>package</span><span class='tag'>&gt;</span><span>  </span> </span></li>
    <li class='alt'><span>  </span> </li>
    <li class=''><span/><span class='tag'><span class='tag-name'>struts</span><span class='tag'>&gt;</span><span>  </span> </span></li>
</ol>
</div>
</font><br/>
</div>
&lt;action&gt;的class是用的类<font>如:<span class='attribute-value'>com.baseframe.action.LoginAction</span></font>,请问什么地方体现了struts+spring呢?<br/>
我觉得是不是应该用spring的bean来代替类呢?<br/>
<br/>
&lt;/action&gt;
7 楼 xugq035 2007-03-24  
javachs 写道
老兄,是不是要用tomcat5.5以上版本才支持struts2呀


我用的是tomcat6.0,应该5.5也没问题的,struts有个j4的包,可以支持jdk1.4,不过我没试过
6 楼 xugq035 2007-03-24  
roundlight 写道
非常感谢 xugq035 的介绍资料,我也想搞个 struts + spring + hibernate 相结合的东西出来, 不知道 这位朋友,能不能给我做一下指导啊,再这里 先谢过了啊

  如果,有机会的话,像你学习啊


共同学习,struts2是个好东西,要摸透它需要时间,不过这段时间公司任务比较多,顾不上这个,有机会交流一下
5 楼 javachs 2007-03-23  
老兄,是不是要用tomcat5.5以上版本才支持struts2呀
4 楼 roundlight 2007-03-22  
非常感谢 xugq035 的介绍资料,我也想搞个 struts + spring + hibernate 相结合的东西出来, 不知道 这位朋友,能不能给我做一下指导啊,再这里 先谢过了啊

  如果,有机会的话,像你学习啊
3 楼 javaChicken 2007-03-22  
hibernat呢?,你是帅哥,都不快点把这个东西写完整
2 楼 xugq035 2007-03-20  
环境搭建基本上就是这样了,再详细等我研究下再说了
1 楼 祁兴明 2007-03-20  
太好了 我正需要这个东东呢 您能写的更详细一点那就更好了 thank you!

相关推荐

    struts2.0.6+spring2.0.3+hibernane3的配置

    ### Struts2.0.6配置 Struts2作为MVC框架的一部分,主要负责处理Web层的请求与响应。其核心配置文件`struts.xml`和`struts.properties`定义了框架的行为与动作映射。 #### `struts.properties`关键配置解析: - *...

    Tomcat5.5+struts2+Spring2.0.6+Hibernate3图书进行管理的系统.zip

    这是一个基于经典的Java Web技术栈构建的图书管理系统,利用了Tomcat5.5作为应用服务器,Struts2作为MVC框架,Spring2.0.6负责依赖注入和事务管理,而Hibernate3则作为对象关系映射(ORM)工具,用于数据库操作。...

    struts1.2.9+spring2.0.6+hibernate3.0.5 整合开发的一个例子

    Struts1.2.9、Spring2.0.6和Hibernate3.0.5是Java Web开发中的三个重要框架,它们的整合应用是早期企业级应用程序的常见实践。这个例子展示了如何将这三个框架集成在一起,以实现高效、灵活的MVC(模型-视图-控制器...

    Struts2+Spring2+Hibernate3 web应用示例

    现在就将笔者使用Myeclipse工具应用struts2 + spring2 + hibernate3 实现CRUD操作的步骤一一纪录下来,为初学者少走弯路略尽绵薄之力!在本文中,笔者将Struts2.0.6、Spring2.0.6和Hibernate3.1进行整合,希望通过...

    Struts2.0+Springframework2.5+ibatis2.3完美整合用户登录及增删改查

    最流行技术Struts2.1 +Spring 2.5.1+ibatis2.3整合开发而成,这与我以前发布的版本中最大特色是整合了Spring2.5.1中的注解功能和半自动化工具ibatis技术,这是本示例的两大特色,简化了配置文件的烦锁,希望能给更多喜欢...

    struts2+spring

    2. **启用Struts2-Spring插件**:在Struts2的配置文件(struts.xml)中启用Struts2-Spring插件,以便让Struts2知道如何与Spring容器交互。 3. **创建自定义拦截器**:为了更好地利用Spring的功能,可能还需要创建...

    新版SSH+DWR配置(Struts2.1.8+Spring3.0+Hibernate3.3.2+DWR2.0.6).doc

    本文将详细介绍如何配置新版SSH+DWR框架,即Struts2.1.8、Spring3.0和Hibernate3.3.2与Direct Web Remoting (DWR) 2.0.6的集成。这个配置示例是基于目前最新的技术栈,旨在提供一个高效、稳定的开发环境。 首先,...

    Struts2+Spring2+Hibernate3 web应用示例------源代码

    现在就将笔者使用Myeclipse工具应用struts2 + spring2 + hibernate3 实现CRUD操作的步骤一一纪录下来,为初学者少走弯路略尽绵薄之力!在本文中,笔者将Struts2.0.6、Spring2.0.6和Hibernate3.1进行整合,希望通过...

    struts2 + spring2 + hibernate3 .pdf

    根据提供的文件信息,本文将详细解析“Struts2 + Spring2 + Hibernate3”技术栈的集成与应用。本文主要从项目准备、环境搭建、公共类的设计等方面进行深入讲解。 ### 一、项目背景及意义 Struts2、Spring2 和 ...

    最新版本Struts2.1.8+Spring3.0+Hibernate3.3.2+DWR2.0.6配置

    ### 最新版本Struts2.1.8+Spring3.0+Hibernate3.3.2+DWR2.0.6配置详解 在本篇内容中,我们将详细探讨如何搭建一个基于Struts2.1.8、Spring3.0、Hibernate3.3.2以及DWR2.0.6的Web应用程序框架。这一组合被称为SSH+...

    Struts2+Spring+Hibernate整合的例子.doc

    Spring2.0.6的引入则提供了对Struts2的集成支持,可以通过Spring的Action代理来管理Action实例,实现依赖注入。Hibernate3.1则负责数据持久化,通过配置映射文件(XML或注解)将Java对象与数据库表关联。 在整合的...

    maven建立struts2+spring+ibatis项目

    3. **配置pom.xml**:在新创建的项目中,编辑pom.xml文件,添加Struts2、Spring和iBatis的依赖。例如: ```xml &lt;!-- Struts2 --&gt; &lt;groupId&gt;org.apache.struts &lt;artifactId&gt;struts2-core &lt;version&gt;2.5.17 ...

    struts2.0+spring2.0+hibernate3.0整合

    使用的框架版本是Struts2.0.6、Spring2.5和Hibernate3.2,这些都是当时比较稳定的版本。JDK6.0是Java开发所需的运行环境,MySQL5.0是关系型数据库管理系统。 在开始整合前,我们需要准备数据库。在这个简单的注册...

    Myeclipse+struts2.0.11+hibernate+spring配置

    在本文中,我们将深入探讨如何在Myeclipse环境中配置一个基于Struts2.0.11、Hibernate和Spring的Web项目。这个配置过程分为几个关键步骤,确保所有必要的库和框架能够协同工作。 首先,我们需要在MyEclipse中创建一...

    java-Struts2-Spring和Hibernate架构应用实例.doc

    开发环境:本文使用的开发环境是MyEclipse5.0+Eclipse3.2+JDK5.0+Tomcat5.5+Struts2.0.6+Spring2.0.6+Hibernate3.1。 示例:本文的示例是一个图书管理系统,提供了基本的增加、删除、修改、查询等功能。示例使用了...

    Spring3.0.5+Mybatis3.0.5+Struts2.0.6整合

    总之,Spring 3.0.5、Mybatis 3.0.5和Struts2.0.6的整合是一个复杂但重要的过程,它涉及到多个层次的配置和代码编写。理解每个框架的核心功能和它们之间的协作机制,是成功完成整合的关键。通过这样的整合,我们可以...

    Struts2+AJAX+JPA+Spring合集(英文版)

    在与Struts2和JPA的集成中,Spring主要负责管理Bean的生命周期、配置以及处理事务,它提供了无缝的集成解决方案,使得整个应用架构更加清晰、模块化。 #### 综合运用案例分析 在实际开发中,结合Struts2、AJAX、...

Global site tag (gtag.js) - Google Analytics