问题描述
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts><!-- Constants --><include file="struts-config-*.xml"></include><constant name="struts.devMode" value="false" /><constant name="struts.i18n.encoding" value="UTF-8" /><constant name="struts.action.extension" value="html" /><constant name="struts.objectFactory" value="spring" /><constant name="struts.custom.i18n.resources" value="ApplicationResources,errors" /><constant name="struts.multipart.maxSize" value="10485760" /><constant name="struts.ui.theme" value="css_xhtml" /><constant name="struts.codebehind.pathPrefix" value="/WEB-INF/pages/" /><constant name="struts.enable.SlashesInActionNames" value="true" /><constant name="struts.convention.action.disableScanning" value="true" /><!-- Configuration for the default package. --><package name="default" extends="struts-default"><interceptors><!-- Interceptor to handle allowing only admins to certain actions --><interceptor name="adminOnly" class="adminInterceptor" /><!--Copied from struts-default.xml and changed validation excludemethods--><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="debugging" /><interceptor-ref name="profiling" /><interceptor-ref name="scopedModelDriven" /><interceptor-ref name="modelDriven" /><interceptor-ref name="fileUpload" /><interceptor-ref name="checkbox" /><interceptor-ref name="staticParams" /><interceptor-ref name="params"><param name="excludeParams">dojo..*</param></interceptor-ref><interceptor-ref name="conversionError" /><interceptor-ref name="validation"><param name="excludeMethods">cancel,execute,delete,edit,list</param></interceptor-ref><interceptor-ref name="workflow"><param name="excludeMethods">input,back,cancel,browse</param></interceptor-ref></interceptor-stack><interceptor-stack name="fileUploadStack"><interceptor-ref name="fileUpload" /><interceptor-ref name="defaultStack" /></interceptor-stack><interceptor-stack name="adminCheck"><interceptor-ref name="defaultStack" /><interceptor-ref name="adminOnly" /></interceptor-stack></interceptors><global-results><result name="mainMenu" type="redirectAction">index</result><result name="dataAccessFailure">/WEB-INF/pages/dataAccessFailure.jsp</result></global-results><global-exception-mappings><exception-mapping exception="org.springframework.dao.DataAccessException"result="dataAccessFailure" /></global-exception-mappings><action name="mainMenu"><result name="success">/WEB-INF/pages/index.jsp</result></action><action name="signup" class="signupAction"><result name="cancel" type="redirect">/</result><result name="input">/WEB-INF/pages/signup.jsp</result><result name="success" type="chain">saveSignup</result></action><action name="saveSignup" class="signupAction" method="save"><result name="input">/WEB-INF/pages/signup.jsp</result><result name="success" type="redirectAction">/mainMenu</result></action><action name="editUser" class="userAction" method="edit"><interceptor-ref name="adminCheck" /><result name="success">/WEB-INF/pages/userForm.jsp</result><result name="input">/WEB-INF/pages/admin/userList.jsp</result></action><action name="editProfile" class="userAction" method="edit"><result name="success">/WEB-INF/pages/userForm.jsp</result><result name="error">/WEB-INF/pages/mainMenu.jsp</result></action><action name="saveUser" class="userAction" method="save"><result name="cancel" type="redirectAction">admin/users</result><result name="input">/WEB-INF/pages/userForm.jsp</result><result name="success" type="redirectAction">admin/users</result></action><action name="queryTargetUsers" class="com.asb.oas.webapp.action.UserAction"method="queryUser"><result name="success" type="stream"><param name="contentCharSet">GBK</param></result></action><!--action name="uploadFile"class="com.asb.oas.webapp.action.FileUploadAction"> <interceptor-refname="fileUploadStack" /> <resultname="input">/WEB-INF/pages/uploadForm.jsp</result> <resultname="success">/WEB-INF/pages/uploadDisplay.jsp</result> <resultname="cancel" type="redirectAction">mainMenu</result> </action--><action name="passwordHint" class="passwordHintAction"><result name="input">/</result><result name="success">/</result></action><action name="index" class="signupAction" method="index"><result>/WEB-INF/pages/index.jsp</result></action>这是从别人的项目里贴过来的,我自己的项目的struts完全没这么复杂啊.谁帮我解释一下,或者指条明路。
解决方案
这也算复杂。。。。配置文件都没看懂,你不去看看官方对每个标签的使用说明?
解决方案二:
刚学struts2的时候看不懂配置文件很正常。。不过确实是一些常用的配置。。推荐个博客,研磨struts2:http://rubbing-struts2.iteye.com/
解决方案三:
https://www.google.com.hk/#newwindow=1&q=struts2+config&safe=strict