下面将是struts.xml,web.applicationContext.xml,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.i18n.encoding" value="GBK"></constant>
<constant name="struts.custom.i18n.resources" value="resources"></constant>
<constant name="struts.objectFactory" value="spring"></constant>
<constant name="struts.action.extension" value="bit,action,do"></constant>
<constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>
<constant name="struts.devMode" value="false"></constant>
<constant name="struts.configuration.xml.reload" value="true"></constant>
<package name="personxml" namespace="/person" extends="struts-default">
<global-results>
<result type="redirectAction">/error.jsp</result>
</global-results>
<action name="person_*" class="mypersonaction" method="{1}">
<result name="suc">
/success.jsp
</result>
<result name="input">
/error.jsp
</result>
<result name="sucinsert">
/successinsert.jsp
</result>
<result name="failureinsert">
/failureinsert.jsp
</result>
</action>
</package>
</struts>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/s2sh</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>root</value>
</property>
</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.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.connection.autocommit">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/hp/shangtongwei/vo/person.hbm.xml</value>
</list>
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="mypersonservice" class="com.hp.shangtongwei.serviceimpl.personserviceimpl">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean name="mypersonaction" class="com.hp.shangtongwei.action.personaction"
scope="prototype" autowire="byName">
<property name="mypersonservice">
<ref bean="mypersonservice" />
</property>
</bean>
</beans>
<?xml version="1.0" encoding="