Sturts2配置文件详解--返回JSON数据的配置

<?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.objectTypeDeterminer" value="notiger" />
	<constant name="struts.objectFactory" value="spring" />
	<constant name="struts.objectFactory.spring.autoWire" value="name" />
	<constant name="struts.ui.theme" value="gem" />
	<constant name="struts.multipart.maxSize" value="1000000000" />
	<constant name="struts.custom.i18n.resources" value="ApplicationResources,processMessages,businessAffect"/>
	<constant name="struts.i18n.encoding" value="UTF-8"/>
	<constant name="struts.ognl.allowStaticMethodAccess" value="true"/>
	<include file="struts-default.xml" />
	<package name="default" extends="struts-default">
		<interceptors>
			<interceptor-stack name="defaultStack">
                <interceptor-ref name="exception"/>
				<interceptor-ref name="alias"/>
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="i18n"/>
                <interceptor-ref name="chain"/>
                <interceptor-ref name="modelDriven"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="staticParams"/>
                <interceptor-ref name="params"/>  
                <interceptor-ref name="conversionError"/>
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>

            </interceptor-stack>
		</interceptors>

		<default-interceptor-ref name="defaultStack" />
		<global-results>
			<result name="error" type="dispatcher">/common/error.jsp</result>
		</global-results>
		<global-exception-mappings>
            <exception-mapping exception="java.lang.Exception" result="globalException"/>
        </global-exception-mappings>
	</package>
	
	<include file="struts-common.xml" />
	<include file="struts-system.xml" />
	<include file="struts-navigate.xml" />
	<include file="struts-processManagement.xml" />
	<include file="struts-bulletin.xml" />
	<include file="struts-workDesktop.xml" />
	<include file="struts-processMonitor.xml" />
	<include file="struts-DRPManagement.xml" />
	<include file="struts-emergencyProcess.xml" />
	<include file="struts-importantInfo.xml" />
	<include file="struts-emergency.xml" />
	<include file="struts-businessAffect.xml" />
	<include file="struts-taskRemind.xml" /><!-- 任务提醒管理 -->
	<include file="struts-bigEvent.xml" /><!-- 大事记 -->
	<include file="struts-historyCrewCall.xml" /><!-- 人员招集历史 -->
	<include file="struts-CrewCall.xml" /><!-- 人员招集 -->
	<include file="struts-importantInfoReport.xml" />
	<include file="struts-emergencyReport.xml" /> <!-- 应急事件上报 -->
	<include file="struts-publicInfo.xml" />
</struts>

 
 
<?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="emergencyProcess" namespace="/emergencyProcess" extends="json-default"> <action name="*InitialConditions" class="initialConditionsAction" method="{1}InitialConditions"> <result name="monitor">/emergencyProcess/initialConditionsMonitor.jsp </result> <result name="cammander">/emergencyProcess/initialConditionsCammander.jsp </result> <result name="rs" type="json"> <param name="root">success</param> </result> <result name="list" type="json"> <param name="root">initialConditionsList</param> </result> <result name="mapList" type="json"> <param name="root">mapList</param> </result> </action> <action name="*FaultLocalization" class="faultLocalizationAction" method="{1}FaultLocalization"> <result>/emergencyProcess/faultLocalization.jsp</result> <result name="rs" type="json"> <param name="root">success</param> </result> <result name="list" type="json"> <param name="root">faultLocalizationList</param> </result> <result name="mapList" type="json"> <param name="root">mapList</param> </result> <result name="errorDetail" type="json"> <param name="root">errorDetailList</param> </result> </action> <action name="*DamageEvaluation" class="damageEvaluationAction" method="{1}DamageEvaluation"> <result>/emergencyProcess/damageEvaluation.jsp</result> <result name="rs" type="json"> <param name="root">success</param> </result> <result name="list" type="json"> <param name="root">damageEvaluationList</param> </result> <result name="mapList" type="json"> <param name="root">mapList</param> </result> </action> <action name="*DecisionMaking" class="decisionMakingAction" method="{1}DecisionMaking"> <result>/emergencyProcess/decisionMaking.jsp</result> <result name="show">/emergencyProcess/show/decisionMaking.jsp </result> <result name="rs" type="json"> <param name="root">success</param> </result> <result name="list" type="json"> <param name="root">decisionMakingList</param> </result> <result name="mapList" type="json"> <param name="root">mapList</param> </result> <!-- 执行任务 --> <result name="showExecTask" type="redirect"> <param name="location">/workDesktop/showExecTaskInstance.action</param> <param name="workItem.workItemId">${workItem.workItemId}</param> <param name="flagSubmitEvent">${flagSubmitEvent}</param> </result> </action> <action name="deleteEvent" class="eventAction" method="deleteEvent"> <result name="success" type="json"> <param name="includeProperties"> result </param> </result> </action> <action name="closeEvent" class="eventAction" method="closeEvent"> <result name="success" type="json"> <param name="includeProperties"> result </param> </result> </action> <action name="accessJudge" class="eventAction" method="accessJudge"> <result name="success">/emergencyProcess/eventManage.jsp</result> <result name="error">/common/errorPage.jsp</result> </action> <action name="deleteDecisionMaking" class="decisionManageAction" method="deleteDecisionMaking"> <result name="success" type="json"> <param name="includeProperties"> result,message </param> </result> </action> <action name="isAllowDelete" class="decisionManageAction" method="isAllowDelete"> <result name="success" type="json"> <param name="root"> result </param> </result> </action> <action name="saveEvent" class="eventAction" method="saveEvent"> <result name="success" type="json"> <param name="includeProperties"> result </param> </result> </action> <action name="lookEvent" class="eventAction" method="lookEvent"> <result name="success">emergencyProcess/event.jsp</result> <result name="error">common/error.jsp</result> </action> <action name="getEventIdByMakingId" class="decisionManageAction" method="getEventIdByMakingId"> <result name="success" type="json"> <param name="root">id</param> </result> </action> </package> </struts>  


这是Struts2项目的一个总配置文件和一个与讲解相关的配置文件。

我对参数<param name="includeProperties"> result,message </param>很疑惑,不知道是什么意思,你知道吗?

开发BC&A笔记:

Action->(Service->)ServiceImp->Dao+JavaBean->DB

............

..........

......

..

我去Google了一下,找出了答案,贴出来,为了和我一样曾今疑惑过的人:

下面是bean注入文件(Spring)

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <import resource="com.hp.ts.bca.emergencyProcess.service.xml" /> <import resource="com.hp.ts.bca.common.service.xml" /> <import resource="com.hp.ts.bca.system.service.xml" /> <import resource="com.hp.ts.bca.bulletin.service.xml" /> <bean id="initialConditionsAction" class="com.hp.ts.bca.emergencyProcess.web.action.InitialConditionsAction" singleton="false"> <property name="submitEventService" ref="submitEventService" /> <property name="initialConditionsService" ref="initialConditionsService" /> </bean> <bean id="faultLocalizationAction" class="com.hp.ts.bca.emergencyProcess.web.action.FaultLocalizationAction" singleton="false"> <property name="submitEventService" ref="submitEventService" /> <property name="faultLocalizationService" ref="faultLocalizationService" /> <property name="errorTypeService" ref="errorTypeService" /> </bean> <bean id="damageEvaluationAction" class="com.hp.ts.bca.emergencyProcess.web.action.DamageEvaluationAction" singleton="false"> <property name="submitEventService" ref="submitEventService" /> <property name="damageEvaluationService" ref="damageEvaluationService" /> <property name="emergencyProgrammeService" ref="emergencyProgrammeService" /> <property name="faultLocalizationService" ref="faultLocalizationService" /> </bean> <bean id="decisionMakingAction" class="com.hp.ts.bca.emergencyProcess.web.action.DecisionMakingAction" singleton="false"> <property name="workItemService" ref="workItemService" /> <property name="processService" ref="processService" /> <property name="taskInstanceService" ref="taskInstanceService" /> <property name="submitEventService" ref="submitEventService" /> <property name="decisionMakingService" ref="decisionMakingService" /> <property name="emergencyProgrammeService" ref="emergencyProgrammeService" /> </bean> <bean id="eventAction" class="com.hp.ts.bca.emergencyProcess.web.action.EventAction" singleton="false"> <property name="submitEventService" ref="submitEventService" /> <property name="systemParameterService" ref="parameterService" /> <property name="systemLogService" ref="systemLogService" /> <property name="userService" ref="userService" /> <property name="decisionManageService" ref="decisionManageService" /> </bean> <bean id="decisionManageAction" class="com.hp.ts.bca.emergencyProcess.web.action.DecisionManageAction" singleton="false"> <property name="decisionMakingService" ref="decisionManageService" /> <property name="systemParameterService" ref="parameterService" /> <property name="userService" ref="userService" /> </bean> </beans>


 
 
 

                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值