1.导入相应jar包.
2.web.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
</web-app>
3.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.custom.i18n.resources" value = "messageResoure_zh_CN"/> <constant name="struts.ui.theme" value="simple" /> <constant name="struts.multipart.maxSize" value="41943040" /> <constant name="struts.action.extension" value="action,do,htm" /> <package name="user" extends="struts-default" > <action name="listInfoPar" class="ListInfoParAction"> <result>/Admin/NewsTypeList.jsp</result> </action> <action name="addInfoPar" class="addInfoParAction" > <result name="success" type="redirect">listInfoPar.action</result> </action> <action name="splitPage" class="SplitPageAction"> <result name="back">/Admin/NewsList.jsp</result> <result name="web">/bcview_list.jsp</result> </action> </package> </struts>
4.spring applicationContext.xml配置
<?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-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"> </property> <property name="url" value="jdbc:oracle:thin:@192.168.0.119:1521:ubest"> </property> <property name="username" value="oracle"></property> <property name="password" value="oracle"></property> <!-- Connection Pooling Info --> <property name="initialSize" value="5" /> <property name="maxActive" value="100" /> <property name="maxIdle" value="30" /> <property name="maxWait" value="1000" /> <property name="poolPreparedStatements" value="false" /> <property name="defaultAutoCommit" value="true" /> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="hibernate.show_sql"> true </prop> <prop key="format_sql"> true </prop> </props> </property> <property name="mappingResources"> <list> <value>com/bc/bean/AdminSheet.hbm.xml</value> <value>com/bc/bean/AdInformationSheet.hbm.xml</value> <value> com/bc/bean/InformationParentSheet.hbm.xml </value> <value>com/bc/bean/InformationSheet.hbm.xml</value> <value>com/bc/bean/IntentCustomerSheet.hbm.xml</value> <value>com/bc/bean/PortalSheet.hbm.xml</value> <value>com/bc/bean/PicNewsSheet.hbm.xml</value> </list> </property> </bean> <bean id="Dao" class="com.bc.dao.impl.daoImpl"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <bean id="UserService" class="com.bc.service.impl.userServiceImpl"> <property name="dao"> <ref bean="Dao"/> </property> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <!-- 定义事务管理Bean--> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <!-- 定义事务传播特性 --> <tx:advice id="txadvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="*find*" propagation="NOT_SUPPORTED" read-only="true"/> <tx:method name="*add*" propagation="REQUIRED"/> <tx:method name="*remove*" propagation="REQUIRED"/> <tx:method name="*update*" propagation="REQUIRED"/> </tx:attributes> </tx:advice> <!-- 定义切面 --> <aop:config> <aop:pointcut id="aoppoint" expression="execution(* com.bc.service.impl.userServiceImpl.*.*(..))"/> <aop:advisor advice-ref="txadvice" pointcut-ref="aoppoint"/> </aop:config> <!-- 配置Action --> <bean id="addInfoParAction" class="com.bc.web.AddInfoParAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfoParAction" class="com.bc.web.ListInfoParAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfoPar2Action" class="com.bc.web.ListInfoPar2Action" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="RemoveInfoParAction" class="com.bc.web.RemoveInfoParAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdatePInfoParAction" class="com.bc.web.UpdatePInfoParAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdatePInfoAction" class="com.bc.web.UpdatePInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdatePADInfoAction" class="com.bc.web.UpdatePADInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdateInfoParAction" class="com.bc.web.UpdateInfoParAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdateInfoAction" class="com.bc.web.UpdateInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdateRecNewsAction" class="com.bc.web.UpdateRecNewsAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdateHeadlineAction" class="com.bc.web.UpdateHeadlineAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdateADInfoAction" class="com.bc.web.UpdateADInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="AddInfoAction" class="com.bc.web.AddInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="AddADInfoAction" class="com.bc.web.AddADInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="AddIntCustomerAction" class="com.bc.web.AddIntCustomerAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfoAction" class="com.bc.web.ListInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfo2BCWebIndexAction" class="com.bc.web.ListInfo2BCWebIndexAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfoByInfoParId2WebAction" class="com.bc.web.ListInfoByInfoParId2WebAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfo2PointFamilyAction" class="com.bc.web.ListInfo2PointFamilyAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfoDetailByIfIdAction" class="com.bc.web.ListInfoDetailByIfIdAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfo2BCTrendsAction" class="com.bc.web.ListInfo2BCTrendsAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListRecNewsAction" class="com.bc.web.ListRecNewsAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListHeadlineNewsAction" class="com.bc.web.ListHeadlineNewsAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfoByInfoParIdAction" class="com.bc.web.ListInfoByInfoParIdAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListInfoByInfoParId2BackAction" class="com.bc.web.ListInfoByInfoParId2BackAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListADInfoAction" class="com.bc.web.ListADInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListIntCustomerAction" class="com.bc.web.ListIntCustomerAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="RemoveInfoAction" class="com.bc.web.RemoveInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="RemoveInfoPictureAction" class="com.bc.web.RemoveInfoPictureAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="RemoveADInfoAction" class="com.bc.web.RemoveADInfoAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="SplitPageAction" class="com.bc.web.SplitPageAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="IsRecAction" class="com.bc.web.IsRecAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="IsHeadAction" class="com.bc.web.IsHeadAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="IsPicAction" class="com.bc.web.IsPicAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="PortalFlashAction" class="com.bc.web.PortalFlashAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="ListFocusNewsAction" class="com.bc.web.ListFocusNewsAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdatePPortalFlashAction" class="com.bc.web.UpdatePPortalFlashAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdatePFocusNewsAction" class="com.bc.web.UpdatePFocusNewsAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdatePortalAction" class="com.bc.web.UpdatePortalAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> <bean id="UpdateFocusAction" class="com.bc.web.UpdateFocusAction" scope="prototype"> <property name="userService"> <ref bean="UserService"/> </property> </bean> </beans>
发表评论
-
dispatch与redirect的区别
2011-08-23 17:11 839待 -
Struts2 Validation验证实例
2011-08-22 21:46 782使用的ActionSurport的validate方法。 ... -
The Struts dispatcher cannot be found. This is usually caused by using Struts ta
2011-08-22 21:39 9248HTTP Status 500 - type Ex ... -
struts2拦截器权限判断实例
2011-08-09 14:07 709struts2与Spring的jar包请自行导入. 代 ... -
struts2传值jsp
2011-06-24 11:13 13071.action package com.bc.web ... -
ajax与json
2011-06-24 10:29 7741.ajax请求servlet(picnews.js) ... -
java验证码实例
2011-06-24 10:08 18691.servlet, ImageServlet.java ... -
struts2<s:data>标签轻松显示日期
2011-06-23 09:46 1104<s:date name="ifPtTime& ... -
spring配置文件
2011-06-22 17:16 713<?xml version="1.0&q ... -
struts2文本编辑器(ckeditor),简单调用不需要多余配置
2011-06-22 17:15 2542调用: <%@ page language ... -
struts2上传
2011-06-22 16:57 7661.Action类 package com.bc.we ... -
简单的hibernate分页代码
2011-06-22 16:16 960public class userServiceImpl ...
相关推荐
### 徒手配置Struts2的关键知识点 #### 一、徒手配置Struts2环境时需注意的关键事项 在没有使用任何集成开发环境的情况下配置Struts2,可能会遇到各种问题,尤其是在配置过程中对于细节的把握至关重要。以下是配置...
**标题:“Eclipse配置Struts2”** 在Java Web开发中,Struts2是一个非常流行的MVC(模型-视图-控制器)框架,它提供了一种结构化的方式来组织应用程序,提高了开发效率。Eclipse作为Java开发的主要IDE,配置Struts...
在这个“配置struts2需要的资源包”的主题中,我们将详细探讨Struts2的核心组件、依赖库以及如何精简不必要的包。 1. **Struts2核心组件**: - **Struts2核心库**:`struts2-core.jar`包含了框架的核心功能,如...
在Eclipse中配置Struts2项目(html)手把手教会你 如何在Eclipse中配置Struts2。 struts2 标签库介绍(html)对Struts2的标签做了详细的介绍让你轻松掌握Struts2的标签。 STRUTS2学习文档.pdf 对Struts2的一些配置...
配置Struts2开发环境是开始使用该框架的第一步。本章将详细介绍如何利用Java EE应用服务器Glassfish和Java开发工具Eclipse搭建Struts2的开发环境。 首先,我们需要安装JDK,它是Java开发的基础。JDK(Java ...
MyEclipse作为一款强大的集成开发环境,提供了图形界面来帮助开发者快速配置Struts2框架。下面,我们将详细讨论如何在MyEclipse2013中使用图形界面配置Struts2,以及这个过程中的关键知识点。 首先,我们需要理解...
配置struts2 - 风轻云淡 配置struts2 - 风轻云淡
Eclipse中配置Struts2项目指南 Struts2 是一个基于MVC 模式的Web 应用程序框架,它提供了一种灵活的方式来构建Web 应用程序。在 Eclipse 中配置 Struts2 项目需要经过多个步骤,包括安装所需软件、配置环境、创建...
此为MyEclipse下Struts2的配置使用文档,附件包括配置步骤文档及源码,文档为本人学习struts2配置一步一步所写,完全为个人对struts2的学习理解,如有不正确的地方,请留言批评指正,谢谢!附件包含项目源码,为本人...
在配置Struts2时,正确地添加所有必需的jar包至关重要,因为它们提供了框架运行所需的类和功能。 首先,让我们了解一些核心的jar包及其作用: 1. **struts2-core.jar**:这是Struts2的核心库,包含了所有基本的...
【安装配置JAVAEclipse配置Struts2项目】 在Java开发环境中,Eclipse是一款非常流行的集成开发环境(IDE)。配置Eclipse以支持Struts2框架的项目开发涉及到多个步骤,包括软件的安装、Eclipse的配置以及Struts2项目...
Eclipse 配置 Struts2 详解 Struts2 是一个基于 Java 语言的 WEB 应用程序框架,它提供了一个灵活的基于 MVC 模式的架构来开发 WEB 应用程序。要使用 Struts2,需要在 Eclipse 环境中进行配置。本文将详细介绍如何...
手动配置Struts2涉及多个步骤,下面我们将深入探讨这个过程。 首先,我们需要在项目的类路径下添加Struts2的核心库。这通常包括`struts2-core`、`struts2-convention-plugin`、`struts2-json-plugin`等依赖,它们...
本文将详细介绍如何在MyEclipse环境中配置Struts2的基本运行环境,包括必要的jar包导入、XML文件配置及Action类的编写等关键步骤。 #### 二、环境搭建准备 ##### 1. 导入Struts2依赖库jar包 在MyEclipse中配置...
在Eclipse中配置Struts2是一项基础且重要的工作,它涉及到Java Web开发中的MVC框架应用。Struts2是Apache软件基金会的一个开源项目,提供了一种用于构建企业级Web应用程序的强大的MVC框架。以下将详细介绍如何在...
本教程将详细介绍如何在MyEclipse集成开发环境中配置Struts2框架。 首先,我们需要新建一个Web项目。在MyEclipse中,选择“New” -> “Web Project”,然后按照提示输入项目名称,确认创建。这一步会生成一个基本的...