天天看點

Struts2+Hibernate3+Spring3簡單整合練習

第一步:Struts2環境的搭建

    1.從http://struts.apache.org/2.1.8.1/index.html下載下傳struts2.1.8。如果可能的話盡量下載下傳110mb的那個。雖然大了點但包含了源碼、文檔和示例。

    2.打開Eclipse,建立WEB項目,名稱為S2SH。将struts2.1.8解壓後的lib目錄下的commons-fileupload-1.2.1.jar、commons-io-1.3.2.jar、freemarker-2.3.15.jar、ognl-2.7.3.jar、struts2-core-2.1.8.1.jar、xwork-core-2.1.6.jar這6個jar包拷貝到建立的web項目lib目錄下。

    3.添加Struts2的過濾器。打開web.xml修改如下。

  <?xml version="1.0" encoding="UTF-8"?>

  <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

           xmlns="http://java.sun.com/xml/ns/javaee"

           xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

           id="WebApp_ID" version="2.5">

 <filter>

  <filter-name>struts2</filter-name>

  <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

 </filter>

 <filter-mapping>

  <filter-name>struts2</filter-name>

  <url-pattern>/*</url-pattern>

  <dispatcher>FORWARD</dispatcher>

  <dispatcher>REQUEST</dispatcher>

 </filter-mapping>

 <welcome-file-list>

  <welcome-file>index.jsp</welcome-file>

 </welcome-file-list>

</web-app>

    4.在類路徑下建立struts.xml檔案,友善起見可以直接拷貝struts2-blank-2.1.8.1下空的struts.xml。

    5.添加類User和UserAction,如下。為了我們的action能有更多的功能,可以繼承ActionSupport,覆寫其execute方法

    User.class如下

package test.s2sh;

public class User {

 private String userName;

 private String sex;

 private Integer age;

 private String address;

//set,get略

}

    UserAction.class如下

package test.s2sh;

public class UserAction{

 private User user;

 public User getUser() {

  return user;

 }

 public void setUser(User user) {

  this.user = user;

 }

 public String execute() throws Exception {

  user = new User();

  user.setAddress("地球");

  user.setAge(25);

  user.setSex("男");

  user.setUserName("中國");

  return "success";

 }

}

    6.把寫好的action配置到struts.xml中,配置檔案如下

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC

    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

 <package name="default" namespace="/" extends="struts-default">

  <action name="user" class="test.s2sh.UserAction">

   <result>WEB-INF/jsp/user.jsp</result>

  </action>

 </package>

</struts>

    7.在WEB-INF目錄下建立jsp目錄,并添加user.jsp檔案。jsp内容如下

<%@ page language="java" contentType="text/html; charset=UTF-8"

 pageEncoding="UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>s2sh</title>

</head>

<body>

   我的資訊如下:<br />

   姓名:<s:property value="user.userName"/><br />

   性别:<s:property value="user.sex"/><br />

   年齡:<s:property value="user.age"/><br />

   位址:我來自<s:property value="user.address"/><br />

</body>

</html>

    8.在index.jsp檔案中添加<jsp:forward page="user"/>,内容如下

<%@ page language="java" contentType="text/html; charset=UTF-8"

 pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>index</title>

</head>

<body>

<jsp:forward page="user"/>

</body>

</html>

    9.好了,把此工程部署到tomcat6上,打開浏覽器通路http://localhost:8080/S2SH/

浏覽器顯示如下資訊:

我的資訊如下:

姓名:中國 

性别:男 

年齡: 25 

位址:我來自地球

   10.現在struts2運作環境搭建完成,特别注意的是<dispatcher>FORWARD</dispatcher>和<dispatcher>REQUEST</dispatcher>不能省略,否則index.jsp将無法通路到UserAction。

第二步:struts2+spring3.0整合

   1.下載下傳spring3.0,網址為http://www.springsource.org/download,單擊spring Framework 3.0.2.RELEASE下的Download進入下載下傳頁面(要填個表單才要下載下傳)。找到下載下傳頁面後會有三個下載下傳檔案,名字為spring-framework-3.0.2.RELEASE.zip的是要下載下傳的檔案。  

   2.添加jar包,解壓縮下載下傳好的檔案找到下面jar包,添加到lib目錄下

       org.springframework.asm-3.0.2.RELEASE.jar

       org.springframework.beans-3.0.2.RELEASE.jar

       org.springframework.context-3.0.2.RELEASE.jar

       org.springframework.core-3.0.2.RELEASE.jar

       org.springframework.expression-3.0.2.RELEASE.jar

       org.springframework.web-3.0.2.RELEASE.jar

     在下載下傳的struts2.1.8下找到下面jar檔案,添加進lib目錄下

       struts2-spring-plugin-2.1.8.1.jar

       commons-logging-api-1.1.jar

    3.修改web.xml檔案添加spring的監聽器,配置如下

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

 xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

 id="WebApp_ID" version="2.5">

 <filter>

  <filter-name>struts2</filter-name>

  <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

 </filter>

 <filter-mapping>

  <filter-name>struts2</filter-name>

  <url-pattern>/*</url-pattern>

  <dispatcher>FORWARD</dispatcher>

  <dispatcher>REQUEST</dispatcher>

 </filter-mapping>

 <listener>

  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

 </listener>

 <welcome-file-list>

  <welcome-file>index.jsp</welcome-file>

 </welcome-file-list>

</web-app>

    4.在WEB-INF目錄下添加applicationContext.xml,把UserAction交給Spring管理。内容如下

<?xml version="1.0" encoding="UTF-8"?>

<beans  xmlns="http://www.springframework.org/schema/beans"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xmlns:aop="http://www.springframework.org/schema/aop"  

  xmlns:tx="http://www.springframework.org/schema/tx"

  xmlns:context="http://www.springframework.org/schema/context"

  xsi:schemaLocation="

   http://www.springframework.org/schema/beans 

   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

   http://www.springframework.org/schema/aop 

   http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

   http://www.springframework.org/schema/tx 

   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

   http://www.springframework.org/schema/context      

   http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

 <bean name="userActionBean" class="test.s2sh.UserAction"/>

</beans>

     5.修改struts.xml檔案,内容如下

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC

    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

    <constant name="struts.objectFactory" value="spring"/>

 <package name="default" namespace="/" extends="struts-default">

  <action name="user" class="userActionBean">

   <result>WEB-INF/jsp/user.jsp</result>

  </action>

 </package>

</struts>

     6.至此所有配置都已完成,再次運作項目。如果成功則頁面顯示和上一步相同,内容如下

我的資訊如下:

姓名:中國 

性别:男 

年齡: 25 

位址:我來自地球

     7.現在隻是簡單地實作了将action交由Spring管理。Spring的作用當然不止是這樣。

第三步:将Spring3.0和hibernate的整合

    1.從官網下載下傳hibernate,網址為http://sourceforge.net/projects/hibernate/files/hibernate3/3.5.1-Final/。 

     2.添加jar檔案,解壓縮hibernate3.5檔案找到下面jar包,添加進lib目錄

        antlr-2.7.6.jar 

        commons-collections-3.1.jar 

        dom4j-1.6.1.jar 

        javassist-3.9.0.GA.jar 

        jta-1.1.jar

        slf4j-api-1.5.8.jar 

        hibernate3.jar

   一下兩個jar包在Spring3.0的spring-framework-3.0.2.RELEASE-dependencies.zip裡面包含,不想從官網下的可以從我提供的附件中獲得

        com.springsource.org.aopalliance-1.0.0.jar  這個可以在struts2.1.8的lib下找到。

        com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar

   在Spring3.0的dist目錄下找到如下jar包,添加進lib目錄

        org.springframework.jdbc-3.0.2.RELEASE.jar

        org.springframework.aop-3.0.2.RELEASE.jar

        org.springframework.orm-3.0.2.RELEASE.jar

        org.springframework.transaction-3.0.2.RELEASE.jar

   從網上下載下傳slf4j的實作包,還好以前有下載下傳不然又要baidu了。。。

        slf4j-jdk14-1.5.8.jar      

   添加資料庫驅動檔案

       我用的是mysql5,并且在tomcat6的lib目錄下以前已經添加了mysql-connector-java-5.1.10-bin.jar驅動,是以可以不用再添加驅動到項目的lib目錄。 

   3.修改User類添加id屬性以及set、get方法,并添加hibernate的Mapping檔案User.hbm.xml,如下

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC 

                 "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 

        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="test.s2sh">

    <class name="User" table="user">

     <id name="id" column="id">

      <generator class="native" />

     </id>

     <property name="userName" />

     <property name="sex" length="2"/>

     <property name="age" />

     <property name="address"/>

    </class>

</hibernate-mapping>

      增加UserDao以及實作類UserDaoImpl ,内容如下

package test.s2sh;

public interface UserDao {

 public void addUser(User user);

}

package test.s2sh;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class UserDaoImpl extends HibernateDaoSupport implements UserDao{

 public void addUser(User user) {

   this.getHibernateTemplate().save(user);

 }

}

      4.修改action,因為内容太簡單了,是以就直接調用DAO了。内容如下

package test.s2sh;

public class UserAction{

 private User user;

 private UserDao userDao;

 //增加一個set方法,讓spring注入

 public void setUserDao(UserDao userDao) {

  this.userDao = userDao;

 }

 public User getUser() {

  return user;

 }

 public void setUser(User user) {

  this.user = user;

 }

 public String execute() throws Exception {

  user = new User();

  user.setAddress("地球");

  user.setAge(25);

  user.setSex("男");

  user.setUserName("中國");

  userDao.addUser(user);

  return "success";

 }

}

    5修改applicationContext.xml,添加對hibernate的支援,如下。 

<?xml version="1.0" encoding="UTF-8"?>

<beans  xmlns="http://www.springframework.org/schema/beans"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xmlns:aop="http://www.springframework.org/schema/aop"  

  xmlns:tx="http://www.springframework.org/schema/tx"

  xmlns:context="http://www.springframework.org/schema/context"

  xsi:schemaLocation="

   http://www.springframework.org/schema/beans 

   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

   http://www.springframework.org/schema/aop 

   http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

   http://www.springframework.org/schema/tx 

   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

   http://www.springframework.org/schema/context      

   http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

 <!-- 配置資料庫連接配接 -->

 <bean name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">

  <!-- jdbc4.0 已經不需要指定驅動的類名了,當然這需要所添加的驅動符合jdbc4.0标準 

  <property name="driverClassName" value="com.mysql.jdbc.Driver"/>

  -->

  <property name="url" value="jdbc:mysql://localhost:3306/test"/>

  <property name="username" value="root"/>

  <property name="password" value="123456"/>

 </bean>

 <!-- 內建hibernate的配置檔案 -->

 <bean name="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

  <property name="dataSource" ref="dataSource"/>

  <property name="mappingResources">

   <list>

    <value>test/s2sh/User.hbm.xml</value>

   </list>

  </property>

  <property name="hibernateProperties">

   <value>

    hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect

    hibernate.show_sql=true

    hibernate.hbm2ddl.auto=create-drop

   </value>

  </property>

 </bean>

 <!-- 配置事務管理器 -->

 <bean name="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">

  <property name="sessionFactory" ref="sessionFactory"/>

 </bean>

 <tx:advice id="txAdvice" transaction-manager="transactionManager">

  <tx:attributes>

   <tx:method name="add*" propagation="REQUIRED"/>

  </tx:attributes>

 </tx:advice>

 <aop:config>

  <!-- 因為邏輯太簡單了,是以就把事務配置在了Dao層。實際使用中是不會在dao層配置事務的。 -->

  <aop:advisor advice-ref="txAdvice" pointcut="execution(* test.s2sh.UserDao.*(..))"/>

 </aop:config>

 <!-- 這裡使用了set方法進行注入-->

 <bean name="userDao" class="test.s2sh.UserDaoImpl">

  <property name="sessionFactory" ref="sessionFactory"/>

 </bean>

 <bean name="userActionBean" class="test.s2sh.UserAction">

     <property name="userDao" ref="userDao"/>

 </bean>

</beans>

   6.然後把工程布置到tomcat下,通路http://localhost:8080/S2SH/ ,顯示輸入如下

我的資訊如下:

姓名:中國

性别:男

年齡:25

位址:我來自地球

已成功儲存資訊至資料庫,傳回id為:1

至此,S2SH的整合全部完成,當然這隻是HelloWorld級别的練習。仔細數下發現一共用到了28個jar檔案,汗。。。

最後附上slf4j-jdk14-1.5.8.jar,com.springsource.org.aopalliance-1.0.0.jar,com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar

  • slf4j-jdk14-1.5.8.jar (8.6 KB)
  • 下載下傳次數: 218
  • com.springsource.org.aopalliance-1.0.0.jar (4.5 KB)
  • 下載下傳次數: 223
  • com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar (1.6 MB)
  • 下載下傳次數: 330

分享到: 

Struts2+Hibernate3+Spring3簡單整合練習
Struts2+Hibernate3+Spring3簡單整合練習

java的匿名類

  • 2010-04-28 11:38
  • 浏覽 8711
  • 評論(8)
  • 分類:程式設計語言
  • 相關推薦
評論

8 樓  wangqingbo1225 2012-01-16   多謝,已經成功哦 7 樓  dimm456852 2010-09-27   能在深夜找到這個文章實在是太幸運了,我今天為 包 問題困擾了一個下午,最終在樓主的幫助下解決了,深表感謝 6 樓  Maci_Hotesion 2010-07-06   感謝樓主分享,特别好,我用的是Oracle,按照你的步驟做了。都已經成功了。 5 樓  酷的飛上天空 2010-05-23   zylzylzyl 寫道 感謝新手非常實用 

但有地方寫錯了 

5.修改web.xml檔案,内容如下 

<?xml version="1.0" encoding="UTF-8" ?> 

<!DOCTYPE struts PUBLIC 

應該是 5.修改action.xml檔案,内容如下

呵呵 還真沒注意,開始發了幾次都沒成功結果格式搞亂了。 

最後索性去除了所有格式,重新整理下。 

多謝你的提醒,更正。 4 樓  zylzylzyl 2010-05-22   感謝新手非常實用 

但有地方寫錯了 

5.修改web.xml檔案,内容如下 

<?xml version="1.0" encoding="UTF-8" ?> 

<!DOCTYPE struts PUBLIC 

    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" 

    "http://struts.apache.org/dtds/struts-2.0.dtd"> 

<struts> 

    <constant name="struts.objectFactory" value="spring"/> 

<package name="default" namespace="/" extends="struts-default"> 

  <action name="user" class="userActionBean"> 

   <result>WEB-INF/jsp/user.jsp</result> 

  </action> 

</package> 

</struts> 

應該是 5.修改action.xml檔案,内容如下 3 樓  酷的飛上天空 2010-05-21   ngman ringman 寫道 樓主您好: 

我如您的操作步驟第一步我成功了 

但在第二步:struts2+spring3.0整合時發生了以下錯誤,但我讓檢查的都檢查了 

請問還有那些要注意的? 

Struts Problem Report 

Struts has detected an unhandled exception: 

這個根據提示是沒找到你的userActionBean類 

可能是配置有點錯誤,最好把配置檔案貼出來看看。 

不好意思,心血來潮随便寫的,沒想到還有人關注。是以就。。。 2 樓  7454103 2010-05-14   估計:'userActionBean   這個在struts2 配置錯了 

具體的話得看你的配置 1 樓  ringman 2010-05-13   樓主您好: 

我如您的操作步驟第一步我成功了 

但在第二步:struts2+spring3.0整合時發生了以下錯誤,但我讓檢查的都檢查了 

請問還有那些要注意的? 

Struts Problem Report 

Struts has detected an unhandled exception: 

Messages: userActionBean 

Unable to instantiate Action, userActionBean, defined for 'user' in namespace '/'userActionBean 

File: org/apache/catalina/loader/WebappClassLoader.java 

Line number: 1,516 

-------------------------------------------------------------------------------- 

Stacktraces 

Unable to instantiate Action, userActionBean, defined for 'user' in namespace '/'userActionBean 

    com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:307) 

    com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388) 

    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187) 

    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) 

    org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) 

    com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47) 

    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478) 

    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) 

    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) 

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 

    org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) 

    org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) 

    org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) 

    org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) 

    org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706) 

    org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677) 

    org.apache.jsp.TestStuts2_005fSpring3.index_jsp._jspService(index_jsp.java:63) 

    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 

    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 

    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) 

    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) 

    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) 

    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 

    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88) 

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 

    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 

    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 

    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 

    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 

    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 

    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 

    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) 

    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 

    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 

    java.lang.Thread.run(Unknown Source) 

java.lang.ClassNotFoundException: userActionBean 

    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516) 

    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361) 

    com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:146) 

    com.opensymphony.xwork2.ObjectFactory.getClassInstance(ObjectFactory.java:96) 

    com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:212) 

    com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:132) 

    com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139) 

    com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109) 

    com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:288) 

    com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388) 

    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187) 

    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) 

    org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) 

    com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47) 

    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478) 

    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) 

    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) 

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 

    org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) 

    org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) 

    org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) 

    org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) 

    org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706) 

    org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677) 

    org.apache.jsp.TestStuts2_005fSpring3.index_jsp._jspService(index_jsp.java:63) 

    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 

    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 

    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) 

    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) 

    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) 

    javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 

    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88) 

    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 

    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 

    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 

    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 

    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 

    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 

    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 

    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 

    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) 

    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 

    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 

    java.lang.Thread.run(Unknown Source)