一个SSH+dwr Web 应用的配置文件

1.web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.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</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>
		<servlet-name>dwr-invoker</servlet-name>
		<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
		<init-param>
			<param-name>debug</param-name>
			<param-value>true</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>dwr-invoker</servlet-name>
		<url-pattern>/dwr/*</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>action</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>
	<jsp-config>
		<taglib>
			<taglib-uri>/tags/struts-bean</taglib-uri>
			<taglib-location>
				/WEB-INF/tlds/struts-bean.tld
			</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>/tags/struts-html</taglib-uri>
			<taglib-location>
				/WEB-INF/tlds/struts-html.tld
			</taglib-location>
		</taglib>
		<taglib>
			<taglib-uri>/tags/struts-logic</taglib-uri>
			<taglib-location>
				/WEB-INF/tlds/struts-logic.tld
			</taglib-location>
		</taglib>

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

</web-app>

2. struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
	<data-sources />
	<form-beans />
	<global-exceptions />
	<global-forwards >
		<forward name="error" path="/WEB-INF/jsp/error.jsp"></forward>
	</global-forwards>
	<action-mappings>
	
		<action path="/bk" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="back" path="/WEB-INF/jsp/mc.jsp" />
		</action>
	
		<action path="/sa" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="sa" path="/WEB-INF/jsp/sa.jsp" />
		</action>
		
		<action path="/sc" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="sc" path="/WEB-INF/jsp/sc.jsp" />
		</action>
		
		<action path="/sp" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="sp" path="/WEB-INF/jsp/sp.jsp" />
		</action>
		
		<action path="/mc" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="mc" path="/WEB-INF/jsp/mc.jsp" />
		</action>
		
		<action path="/cr" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="ack" path="/WEB-INF/jsp/ack.jsp" />
		</action>
		
		<action path="/di" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="di" path="/WEB-INF/jsp/di.jsp" />
		</action>
		
		<action path="/la" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="mc" path="/WEB-INF/jsp/mc.jsp" />
		</action>
		
		<action path="/lc" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="mc" path="/WEB-INF/jsp/mc.jsp" />
		</action>
		
		<action path="/lp" type="org.springframework.web.struts.DelegatingActionProxy">
		<forward name="mc" path="/WEB-INF/jsp/mc.jsp" />
		</action>
		
		
	</action-mappings>
	<message-resources
		parameter="com.ecquaira.wda.struts.ApplicationResources" />

	<plug-in
		className="org.springframework.web.struts.ContextLoaderPlugIn">
		<set-property property="contextConfigLocation"
			value="/WEB-INF/applicationContext.xml" />
	</plug-in>
</struts-config>

3 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"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

	<bean name="/sa"
		class="com.ecquaria.wda.struts.action.SearchAppAction">
	</bean>

	<bean name="/sc"
		class="com.ecquaria.wda.struts.action.SearchClaimAction">
	</bean>

	<bean name="/sp"
		class="com.ecquaria.wda.struts.action.SearchProjectAction">
	</bean>

	<bean name="/la"
		class="com.ecquaria.wda.struts.action.SelectApplicationAction">
	</bean>

	<bean name="/lc"
		class="com.ecquaria.wda.struts.action.SelectClaimAction">
	</bean>
	
	<bean name="/lp"
		class="com.ecquaria.wda.struts.action.SelectProjectAction">
	</bean>

	<bean name="/mc"
		class="com.ecquaria.wda.struts.action.DataInitializeAction">
	</bean>
	
	<bean name="/bk"
		class="com.ecquaria.wda.struts.action.BackAction">
	</bean>

	<bean name="/cr"
		class="com.ecquaria.wda.struts.action.CreateManualClaimAction">
		<property name="manualServices">
			<ref bean="ManualClaimService" />
		</property>
	</bean>

	<bean id="dataSource"
		class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName"
			value="com.mysql.jdbc.Driver">
		</property>
		<property name="url"
			value="jdbc:mysql://localhost:3306/disbursement">
		</property>
		<property name="username" value="root"></property>
		<property name="password" value="admin"></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>
			</props>
		</property>

		<property name="mappingResources">
			<list>
				<value>
					com/ecquaria/wda/hibernate/pojo/Claimdetail.hbm.xml
				</value>
				<value>
					com/ecquaria/wda/hibernate/pojo/Claimentity.hbm.xml
				</value>
				<value>
					com/ecquaria/wda/hibernate/pojo/Claimreason.hbm.xml
				</value>
				<value>
					com/ecquaria/wda/hibernate/pojo/Manualcheque.hbm.xml
				</value>
				<value>
					com/ecquaria/wda/hibernate/pojo/Manualclaim.hbm.xml
				</value>
				<value>
					com/ecquaria/wda/hibernate/pojo/Application.hbm.xml
				</value>
				<value>
					com/ecquaria/wda/hibernate/pojo/Claim.hbm.xml
				</value>
				<value>
					com/ecquaria/wda/hibernate/pojo/Project.hbm.xml
				</value>
			</list>
		</property>
	</bean>

	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>

	<bean id="ManualClaimService"
		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="target">
			<bean
				class="com.ecquaria.wda.services.ManualClaimServices">
				<property name="manualBiz">
					<ref bean="ManualBiz" />
				</property>
				<property name="detailBiz">
					<ref bean="DetailBiz" />
				</property>
				<property name="reasonBiz">
					<ref bean="ReasonBiz" />
				</property>
			</bean>
		</property>
		
		<property name="transactionManager">
			<ref bean="transactionManager"/>
		</property>
		
		<property name="transactionAttributes">
			<props>
				<prop key="creat*">PROPAGATION_REQUIRED,-Exception</prop>
			</props>
		</property>
	</bean>

	<bean id="ClaimreasonDAO"
		class="com.ecquaria.wda.hibernate.dao.ClaimreasonDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="ClaimdetailDAO"
		class="com.ecquaria.wda.hibernate.dao.ClaimdetailDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="ManualclaimDAO"
		class="com.ecquaria.wda.hibernate.dao.ManualclaimDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="ClaimentityDAO"
		class="com.ecquaria.wda.hibernate.dao.ClaimentityDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="ManualchequeDAO"
		class="com.ecquaria.wda.hibernate.dao.ManualchequeDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>

	<bean id="ProjectDAO"
		class="com.ecquaria.wda.hibernate.dao.ProjectDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="ApplicationDAO"
		class="com.ecquaria.wda.hibernate.dao.ApplicationDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>
	<bean id="ClaimDAO"
		class="com.ecquaria.wda.hibernate.dao.ClaimDAO">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>

	<bean id="ManualBiz"
		class="com.ecquaria.wda.bizdelegate.ManualclaimBizdelegate">
		<property name="manualDao">
			<ref bean="ManualclaimDAO" />
		</property>
	</bean>

	<bean id="DetailBiz"
		class="com.ecquaria.wda.bizdelegate.DetailBizdelegate">
		<property name="dao">
			<ref bean="ClaimdetailDAO" />
		</property>
	</bean>

	<bean id="ReasonBiz"
		class="com.ecquaria.wda.bizdelegate.ReasonBizdelegate">
		<property name="dao">
			<ref bean="ClaimreasonDAO" />
		</property>
	</bean>

	<bean id="ajax" class="com.ecquaria.wda.ajax.Ajax">
		<property name="applicationDao">
			<ref bean="ApplicationDAO" />
		</property>
		<property name="claimDao">
			<ref bean="ClaimDAO" />
		</property>
		<property name="projectDao">
			<ref bean="ProjectDAO" />
		</property>
	</bean>

</beans> 

4 dwr.xml

<!DOCTYPE dwr PUBLIC
    "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
    "http://www.getahead.ltd.uk/dwr/dwr10.dtd">
<dwr>
	<allow>
		<create creator="spring" scope="session" javascript="ajax">
			<param name="beanName" value="ajax" />
		</create>

		<convert converter="bean"
			match="com.ecquaria.wda.hibernate.pojo.Application">
		</convert>
		
		<convert converter="bean"
			match="com.ecquaria.wda.hibernate.pojo.Claim">
		</convert>
		
		<convert converter="bean"
			match="com.ecquaria.wda.hibernate.pojo.Project">
		</convert>
	</allow>
</dwr>
 
 

 

你可能感兴趣的:(bean,Web,struts,DWR,ssh)