Author: niallp Date: Mon Mar 6 16:04:15 2006 New Revision: 383716 URL: http://svn.apache.org/viewcvs?rev=383716&view=rev Log: Port to 1.2.x branch - Add "dispatch" flavour actions module to struts-examples webapp
Added: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/ struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/ActionDispatcherExample.java (with props) struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/DispatchExampleAction.java (with props) struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/LookupDispatchExampleAction.java (with props) struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java (with props) struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources.properties (with props) struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources_fr.properties (with props) struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/dispatch/ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/dispatch/struts-config.xml (with props) struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/actionDispatcher.jsp (with props) struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/dispatch.jsp (with props) struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/index.jsp (with props) struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/lookup.jsp (with props) struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/mapping.jsp (with props) Modified: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/web.xml struts/action/branches/STRUTS_1_2_BRANCH/web/examples/welcome.jsp Added: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/ActionDispatcherExample.java URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/ActionDispatcherExample.java?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/ActionDispatcherExample.java (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/ActionDispatcherExample.java Mon Mar 6 16:04:15 2006 @@ -0,0 +1,117 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts.webapp.dispatch; + +import java.util.Map; +import java.util.HashMap; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.struts.actions.ActionDispatcher; +import org.apache.struts.action.Action; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; + +/** + * Example DispatchAction. + * + * @version $Rev$ $Date$ + */ +public class ActionDispatcherExample extends Action { + + private ActionDispatcher dispatcher + = new ActionDispatcher(this, + ActionDispatcher.DISPATCH_FLAVOR); + + private int fooCount; + private int barCount; + + /** + * Execute method. + * + * @param mapping The ActionMapping used to select this instance + * @param form The optional ActionForm bean for this request + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * + * @exception Exception if business logic throws an exception + */ + public ActionForward execute(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + return dispatcher.execute(mapping, form, request, response); + + } + + /** + * Example "foo" method. + * + * @param mapping The ActionMapping used to select this instance + * @param form The optional ActionForm bean for this request + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * + * @exception Exception if business logic throws an exception + */ + public ActionForward doFoo(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + fooCount++; + + ActionMessages messages = new ActionMessages(); + messages.add("foo", new ActionMessage("count.foo.message", fooCount+"")); + saveMessages(request, messages); + + return (mapping.findForward("success")); + + } + + /** + * Example "bar" method. + * + * @param mapping The ActionMapping used to select this instance + * @param form The optional ActionForm bean for this request + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * + * @exception Exception if business logic throws an exception + */ + public ActionForward doBar(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + barCount++; + + ActionMessages messages = new ActionMessages(); + messages.add("bar", new ActionMessage("count.bar.message", barCount+"")); + saveMessages(request, messages); + + return (mapping.findForward("success")); + + } + +} Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/ActionDispatcherExample.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/ActionDispatcherExample.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/DispatchExampleAction.java URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/DispatchExampleAction.java?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/DispatchExampleAction.java (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/DispatchExampleAction.java Mon Mar 6 16:04:15 2006 @@ -0,0 +1,93 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts.webapp.dispatch; + +import java.util.Map; +import java.util.HashMap; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.struts.actions.DispatchAction; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; + +/** + * Example DispatchAction. + * + * @version $Rev$ $Date$ + */ +public class DispatchExampleAction extends DispatchAction { + + private Map keyMethodMap = new HashMap(); + private int fooCount; + private int barCount; + + /** + * Example "foo" method. + * + * @param mapping The ActionMapping used to select this instance + * @param form The optional ActionForm bean for this request + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * + * @exception Exception if business logic throws an exception + */ + public ActionForward doFoo(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + fooCount++; + + ActionMessages messages = new ActionMessages(); + messages.add("foo", new ActionMessage("count.foo.message", fooCount+"")); + saveMessages(request, messages); + + return (mapping.findForward("success")); + + } + + /** + * Example "bar" method. + * + * @param mapping The ActionMapping used to select this instance + * @param form The optional ActionForm bean for this request + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * + * @exception Exception if business logic throws an exception + */ + public ActionForward doBar(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + barCount++; + + ActionMessages messages = new ActionMessages(); + messages.add("bar", new ActionMessage("count.bar.message", barCount+"")); + saveMessages(request, messages); + + return (mapping.findForward("success")); + + } + +} Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/DispatchExampleAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/DispatchExampleAction.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/LookupDispatchExampleAction.java URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/LookupDispatchExampleAction.java?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/LookupDispatchExampleAction.java (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/LookupDispatchExampleAction.java Mon Mar 6 16:04:15 2006 @@ -0,0 +1,110 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts.webapp.dispatch; + +import java.util.Map; +import java.util.HashMap; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.struts.actions.LookupDispatchAction; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; + +/** + * Example LookupDispatchAction. + * + * @version $Rev$ $Date$ + */ +public class LookupDispatchExampleAction extends LookupDispatchAction { + + private Map keyMethodMap = new HashMap(); + private int fooCount; + private int barCount; + + /** + * Constructor - populate the key method map. + */ + public LookupDispatchExampleAction() { + keyMethodMap.put("button.foo.label", "doFoo"); + keyMethodMap.put("button.bar.label", "doBar"); + } + + /** + * Example "foo" method. + * + * @param mapping The ActionMapping used to select this instance + * @param form The optional ActionForm bean for this request + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * + * @exception Exception if business logic throws an exception + */ + public ActionForward doFoo(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + fooCount++; + + ActionMessages messages = new ActionMessages(); + messages.add("foo", new ActionMessage("count.foo.message", fooCount+"")); + saveMessages(request, messages); + + return (mapping.findForward("success")); + + } + + /** + * Example "bar" method. + * + * @param mapping The ActionMapping used to select this instance + * @param form The optional ActionForm bean for this request + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * + * @exception Exception if business logic throws an exception + */ + public ActionForward doBar(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + barCount++; + + ActionMessages messages = new ActionMessages(); + messages.add("bar", new ActionMessage("count.bar.message", barCount+"")); + saveMessages(request, messages); + + return (mapping.findForward("success")); + + } + + /** + * Provides the mapping from resource key to method name. + * + * @return Resource key / method name map. + */ + protected Map getKeyMethodMap() { + return keyMethodMap; + } + +} Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/LookupDispatchExampleAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/LookupDispatchExampleAction.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java Mon Mar 6 16:04:15 2006 @@ -0,0 +1,93 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts.webapp.dispatch; + +import java.util.Map; +import java.util.HashMap; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.struts.actions.MappingDispatchAction; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; + +/** + * Example DispatchAction. + * + * @version $Rev$ $Date$ + */ +public class MappingDispatchExampleAction extends MappingDispatchAction { + + private Map keyMethodMap = new HashMap(); + private int fooCount; + private int barCount; + + /** + * Example "foo" method. + * + * @param mapping The ActionMapping used to select this instance + * @param form The optional ActionForm bean for this request + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * + * @exception Exception if business logic throws an exception + */ + public ActionForward doFoo(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + + fooCount++; + + ActionMessages messages = new ActionMessages(); + messages.add("foo", new ActionMessage("count.foo.message", fooCount+"")); + saveMessages(request, messages); + + return (mapping.findForward("success")); + + } + + /** + * Example "bar" method. + * + * @param mapping The ActionMapping used to select this instance + * @param form The optional ActionForm bean for this request + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * + * @exception Exception if business logic throws an exception + */ + public ActionForward doBar(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + barCount++; + + ActionMessages messages = new ActionMessages(); + messages.add("bar", new ActionMessage("count.bar.message", barCount+"")); + saveMessages(request, messages); + + return (mapping.findForward("success")); + + } + +} Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources.properties URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources.properties?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources.properties (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources.properties Mon Mar 6 16:04:15 2006 @@ -0,0 +1,19 @@ +index.home=Home +index.title=DispatchAction Examples +dispatch.title=DispatchAction Example +mapping.title=MappingDispatchAction Example +lookup.title=LookupDispatchAction Example +actionDispatcher.title=ActionDispatcher Example + +button.foo.label=Foo Button +button.bar.label=Bar Button +button.invalid.label=Invalid Button +method.invalid.label=Invalid Method +method.execute.label=Execute Method +parameter.wrong.label=Wrong Parameter +parameter.missing.label=Missing Parameter +count.foo.message=Foo button count = {0} +count.bar.message=Bar button count = {0} + +dispatch.ServletException=ServletException: {0} +dispatch.NoSuchMethodException=NoSuchMethodException: {0} Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources_fr.properties URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources_fr.properties?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources_fr.properties (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources_fr.properties Mon Mar 6 16:04:15 2006 @@ -0,0 +1,15 @@ +index.title=DispatchAction Exemples +dispatch.title=DispatchAction Exemple +mapping.title=MappingDispatchAction Exemple +lookup.title=LookupDispatchAction Exemple +actionDispatcher.title=ActionDispatcher Exemple + +button.foo.label=Foo Bouton +button.bar.label=Bar Bouton +button.invalid.label=Invalide Bouton +method.invalid.label=Invalid Méthode +method.execute.label=Execute Méthode +parameter.wrong.label=Mauvais Paramètre +parameter.missing.label=Manquer Paramètre +count.foo.message=Foo bouton compte = {0} +count.bar.message=Bar bouton compte = {0} Propchange: struts/action/branches/STRUTS_1_2_BRANCH/src/examples/org/apache/struts/webapp/dispatch/MessageResources_fr.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/dispatch/struts-config.xml URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/dispatch/struts-config.xml?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/dispatch/struts-config.xml (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/dispatch/struts-config.xml Mon Mar 6 16:04:15 2006 @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE struts-config PUBLIC + "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" + "http://struts.apache.org/dtds/struts-config_1_2.dtd"> + +<!-- ===================================== "dispatch" examples module config --> +<struts-config> + + <!-- ============================================= Form Bean Definitions --> + <form-beans> + + <!-- Test form bean --> + <form-bean name="testForm" type="org.apache.struts.action.DynaActionForm"> + <form-property name="testString" type="java.lang.String" /> + </form-bean> + + <!-- Locale form bean --> + <form-bean name="localeForm" type="org.apache.struts.action.DynaActionForm"> + <form-property name="language" type="java.lang.String" /> + <form-property name="country" type="java.lang.String" /> + </form-bean> + + </form-beans> + + <!-- ======================================== Global Forward Definitions --> + <global-forwards> + <forward name="module-root" path="/welcome.do" module=""/> + <forward name="module-dispatch" path="/welcome.do" module="/dispatch"/> + </global-forwards> + + <!-- ========================================= Action Mapping Definitions --> + <action-mappings> + <action path="/welcome" forward="/index.jsp"/> + + <!-- ======================================= DispatchAction Example --> + <action path="/dispatch" forward="/dispatch.jsp"/> + <action path="/dispatch-submit" + type="org.apache.struts.webapp.dispatch.DispatchExampleAction" + parameter="dispatchMethod" + name="testForm" + scope="request"> + <exception key="dispatch.NoSuchMethodException" + type="java.lang.NoSuchMethodException" + path="/dispatch.jsp"/> + <exception key="dispatch.ServletException" + type="javax.servlet.ServletException" + path="/dispatch.jsp"/> + <forward name="success" path="/dispatch.jsp"/> + </action> + <action path="/dispatch-noparam" + type="org.apache.struts.webapp.dispatch.DispatchExampleAction" + name="testForm" + scope="request"> + <exception key="dispatch.ServletException" + type="javax.servlet.ServletException" + path="/dispatch.jsp"/> + <forward name="success" path="/dispatch.jsp"/> + </action> + + <action path="/dispatchLocale" + type="org.apache.struts.webapp.validator.LocaleAction" + name="localeForm" scope="request"> + <forward name="success" path="/dispatch.do"/> + </action> + + <!-- ================================ MappingDispatchAction Example --> + <action path="/mapping" forward="/mapping.jsp"/> + <action path="/mapping-foo" + type="org.apache.struts.webapp.dispatch.MappingDispatchExampleAction" + parameter="doFoo" + name="testForm" + scope="request"> + <forward name="success" path="/mapping.jsp"/> + </action> + <action path="/mapping-bar" + type="org.apache.struts.webapp.dispatch.MappingDispatchExampleAction" + parameter="doBar" + name="testForm" + scope="request"> + <forward name="success" path="/mapping.jsp"/> + </action> + <action path="/mapping-invalid" + type="org.apache.struts.webapp.dispatch.MappingDispatchExampleAction" + parameter="doInvalid" + name="testForm" + scope="request"> + <exception key="dispatch.NoSuchMethodException" + type="java.lang.NoSuchMethodException" + path="/mapping.jsp"/> + <exception key="dispatch.ServletException" + type="javax.servlet.ServletException" + path="/mapping.jsp"/> + <forward name="success" path="/mapping.jsp"/> + </action> + <action path="/mapping-execute" + type="org.apache.struts.webapp.dispatch.MappingDispatchExampleAction" + parameter="execute" + name="testForm" + scope="request"> + <exception key="dispatch.NoSuchMethodException" + type="java.lang.NoSuchMethodException" + path="/mapping.jsp"/> + <exception key="dispatch.ServletException" + type="javax.servlet.ServletException" + path="/mapping.jsp"/> + <forward name="success" path="/mapping.jsp"/> + </action> + <action path="/mapping-noparam" + type="org.apache.struts.webapp.dispatch.MappingDispatchExampleAction" + name="testForm" + scope="request"> + <exception key="dispatch.ServletException" + type="javax.servlet.ServletException" + path="/mapping.jsp"/> + <forward name="success" path="/mapping.jsp"/> + </action> + + <action path="/mappingLocale" + type="org.apache.struts.webapp.validator.LocaleAction" + name="localeForm" scope="request"> + <forward name="success" path="/mapping.do"/> + </action> + + <!-- ================================= LookupDispatchAction Example --> + <action path="/lookup" forward="/lookup.jsp"/> + <action path="/lookup-submit" + type="org.apache.struts.webapp.dispatch.LookupDispatchExampleAction" + parameter="dispatchParam" + name="testForm" + scope="request"> + <exception key="dispatch.ServletException" + type="javax.servlet.ServletException" + path="/lookup.jsp"/> + <forward name="success" path="/lookup.jsp"/> + </action> + <action path="/lookup-noparam" + type="org.apache.struts.webapp.dispatch.LookupDispatchExampleAction" + name="testForm" + scope="request"> + <exception key="dispatch.ServletException" + type="javax.servlet.ServletException" + path="/lookup.jsp"/> + <forward name="success" path="/lookup.jsp"/> + </action> + + <action path="/lookupLocale" + type="org.apache.struts.webapp.validator.LocaleAction" + name="localeForm" scope="request"> + <forward name="success" path="/lookup.do"/> + </action> + + + <!-- ===================================== ActionDispatcher Example --> + <action path="/actionDispatcher" forward="/actionDispatcher.jsp"/> + <action path="/actionDispatcher-submit" + type="org.apache.struts.webapp.dispatch.ActionDispatcherExample" + parameter="actionDispatcherMethod" + name="testForm" + scope="request"> + <exception key="dispatch.NoSuchMethodException" + type="java.lang.NoSuchMethodException" + path="/actionDispatcher.jsp"/> + <exception key="dispatch.ServletException" + type="javax.servlet.ServletException" + path="/actionDispatcher.jsp"/> + <forward name="success" path="/actionDispatcher.jsp"/> + </action> + <action path="/actionDispatcher-noparam" + type="org.apache.struts.webapp.dispatch.ActionDispatcherExample" + name="testForm" + scope="request"> + <exception key="dispatch.ServletException" + type="javax.servlet.ServletException" + path="/actionDispatcher.jsp"/> + <forward name="success" path="/actionDispatcher.jsp"/> + </action> + + <action path="/actionDispatcherLocale" + type="org.apache.struts.webapp.validator.LocaleAction" + name="localeForm" scope="request"> + <forward name="success" path="/actionDispatcher.do"/> + </action> + + <!-- ================================================ Switch Locale --> + <!-- Locale Action --> + <action path="/locale" + type="org.apache.struts.webapp.validator.LocaleAction" + name="localeForm" scope="request"> + <forward name="success" path="/welcome.do"/> + </action> + + </action-mappings> + + <!-- ====================================== Message Resources Definitions --> + <message-resources null="false" + parameter="org.apache.struts.webapp.dispatch.MessageResources" /> + +</struts-config> Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/dispatch/struts-config.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/dispatch/struts-config.xml ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Modified: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/web.xml URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/web.xml?rev=383716&r1=383715&r2=383716&view=diff ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/web.xml (original) +++ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/WEB-INF/web.xml Mon Mar 6 16:04:15 2006 @@ -26,6 +26,10 @@ <param-value>/WEB-INF/validator/struts-config.xml</param-value> </init-param> <init-param> + <param-name>config/dispatch</param-name> + <param-value>/WEB-INF/dispatch/struts-config.xml</param-value> + </init-param> + <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> Added: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/actionDispatcher.jsp URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/actionDispatcher.jsp?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/actionDispatcher.jsp (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/actionDispatcher.jsp Mon Mar 6 16:04:15 2006 @@ -0,0 +1,73 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %><%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %><%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %><%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %> +<html:html> + <head> + <title><bean:message key="actionDispatcher.title" /></title> + <html:base /> + </head> + <body bgcolor="white"> + + <p> + <html:link forward="module-root"><bean:message key="index.home"/></html:link> + + <html:link forward="module-dispatch"><bean:message key="index.title"/></html:link> + </p> + + <hr /> + <p> + <strong>Change Language | Changez Le Langage:</strong> + + <html:link action="/actionDispatcherLocale?language=en">English | Anglais</html:link> + + <html:link action="/actionDispatcherLocale?language=fr">French | Francais</html:link> + </p> + + <hr /> + + <h3><bean:message key="actionDispatcher.title" /></h3> + + <logic:messagesPresent> + <html:messages id="msg"> + <p><strong><font color="red"><bean:write name="msg" /></font></strong></p> + </html:messages> + </logic:messagesPresent> + + <logic:messagesPresent message="true"> + <html:messages message="true" id="msg"> + <p><strong><bean:write name="msg" /></strong></p> + </html:messages> + </logic:messagesPresent> + + <logic:messagesNotPresent message="true"> + <logic:messagesNotPresent> + <p> </p> + </logic:messagesNotPresent> + </logic:messagesNotPresent> + + <p> + <html:form action="actionDispatcher-submit" style="display:inline"> + <input type="hidden" name="actionDispatcherMethod" value="doFoo" /> + <html:submit><bean:message key="button.foo.label" /></html:submit> + </html:form> + + <html:form action="actionDispatcher-submit" style="display:inline"> + <input type="hidden" name="actionDispatcherMethod" value="doBar" /> + <html:submit><bean:message key="button.bar.label" /></html:submit> + </html:form> + + <html:form action="actionDispatcher-submit" style="display:inline"> + <input type="hidden" name="actionDispatcherMethod" value="doInvalid" /> + <html:submit><bean:message key="method.invalid.label" /></html:submit> + </html:form> + + <html:form action="actionDispatcher-submit" style="display:inline"> + <input type="hidden" name="actionDispatcherMethod" value="execute" /> + <html:submit><bean:message key="method.execute.label" /></html:submit> + </html:form> + + <html:form action="actionDispatcher-noparam" style="display:inline"> + <html:submit><bean:message key="parameter.missing.label" /></html:submit> + </html:form> + </p> + + </body> +</html:html> Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/actionDispatcher.jsp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/actionDispatcher.jsp ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/dispatch.jsp URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/dispatch.jsp?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/dispatch.jsp (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/dispatch.jsp Mon Mar 6 16:04:15 2006 @@ -0,0 +1,73 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %><%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %><%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %><%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %> +<html:html> + <head> + <title><bean:message key="dispatch.title" /></title> + <html:base /> + </head> + <body bgcolor="white"> + + <p> + <html:link forward="module-root"><bean:message key="index.home"/></html:link> + + <html:link forward="module-dispatch"><bean:message key="index.title"/></html:link> + </p> + + <hr /> + <p> + <strong>Change Language | Changez Le Langage:</strong> + + <html:link action="/dispatchLocale?language=en">English | Anglais</html:link> + + <html:link action="/dispatchLocale?language=fr">French | Francais</html:link> + </p> + + <hr /> + + <h3><bean:message key="dispatch.title" /></h3> + + <logic:messagesPresent> + <html:messages id="msg"> + <p><strong><font color="red"><bean:write name="msg" /></font></strong></p> + </html:messages> + </logic:messagesPresent> + + <logic:messagesPresent message="true"> + <html:messages message="true" id="msg"> + <p><strong><bean:write name="msg" /></strong></p> + </html:messages> + </logic:messagesPresent> + + <logic:messagesNotPresent message="true"> + <logic:messagesNotPresent> + <p> </p> + </logic:messagesNotPresent> + </logic:messagesNotPresent> + + <p> + <html:form action="dispatch-submit" style="display:inline"> + <input type="hidden" name="dispatchMethod" value="doFoo" /> + <html:submit><bean:message key="button.foo.label" /></html:submit> + </html:form> + + <html:form action="dispatch-submit" style="display:inline"> + <input type="hidden" name="dispatchMethod" value="doBar" /> + <html:submit><bean:message key="button.bar.label" /></html:submit> + </html:form> + + <html:form action="dispatch-submit" style="display:inline"> + <input type="hidden" name="dispatchMethod" value="doInvalid" /> + <html:submit><bean:message key="method.invalid.label" /></html:submit> + </html:form> + + <html:form action="dispatch-submit" style="display:inline"> + <input type="hidden" name="dispatchMethod" value="execute" /> + <html:submit><bean:message key="method.execute.label" /></html:submit> + </html:form> + + <html:form action="dispatch-noparam" style="display:inline"> + <html:submit><bean:message key="parameter.missing.label" /></html:submit> + </html:form> + </p> + + </body> +</html:html> Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/dispatch.jsp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/dispatch.jsp ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/index.jsp URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/index.jsp?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/index.jsp (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/index.jsp Mon Mar 6 16:04:15 2006 @@ -0,0 +1,37 @@ +<%@ page contentType="text/html;charset=UTF-8" %> +<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> +<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> + +<html:html> +<head> +<title><bean:message key="index.title"/></title> +<html:base/> +</head> +<body bgcolor="white"> + + <p> + <html:link forward="module-root"><bean:message key="index.home"/></html:link> + </p> + + <hr /> + <p> + <strong>Change Language | Changez Le Langage:</strong> + + <html:link action="/locale?language=en">English | Anglais</html:link> + + <html:link action="/locale?language=fr">French | Francais</html:link> + </p> + + <hr /> + + <h3><bean:message key="index.title"/></h3> + + <ul> + <li><html:link action="/dispatch"><bean:message key="dispatch.title"/></html:link></li> + <li><html:link action="/mapping"><bean:message key="mapping.title"/></html:link></li> + <li><html:link action="/lookup"><bean:message key="lookup.title"/></html:link></li> + <li><html:link action="/actionDispatcher"><bean:message key="actionDispatcher.title"/></html:link></li> + </ul> + +</body> +</html:html> Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/index.jsp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/index.jsp ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/lookup.jsp URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/lookup.jsp?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/lookup.jsp (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/lookup.jsp Mon Mar 6 16:04:15 2006 @@ -0,0 +1,63 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %><%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %><%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %><%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %> +<html:html> + <head> + <title><bean:message key="lookup.title" /></title> + <html:base /> + </head> + <body bgcolor="white"> + + <p> + <html:link forward="module-root"><bean:message key="index.home"/></html:link> + + <html:link forward="module-dispatch"><bean:message key="index.title"/></html:link> + </p> + + <hr /> + <p> + <strong>Change Language | Changez Le Langage:</strong> + + <html:link action="/lookupLocale?language=en">English | Anglais</html:link> + + <html:link action="/lookupLocale?language=fr">French | Francais</html:link> + </p> + + <hr /> + + <h3><bean:message key="lookup.title" /></h3> + + <logic:messagesPresent> + <html:messages id="msg"> + <p><strong><font color="red"><bean:write name="msg" /></font></strong></p> + </html:messages> + </logic:messagesPresent> + + <logic:messagesPresent message="true"> + <html:messages message="true" id="msg"> + <p><strong><bean:write name="msg" /></strong></p> + </html:messages> + </logic:messagesPresent> + + <logic:messagesNotPresent message="true"> + <logic:messagesNotPresent> + <p> </p> + </logic:messagesNotPresent> + </logic:messagesNotPresent> + + <p> + <html:form action="lookup-submit" style="display:inline"> + <html:submit property="dispatchParam"><bean:message key="button.foo.label" /></html:submit> + + <html:submit property="dispatchParam"><bean:message key="button.bar.label" /></html:submit> + + <html:submit property="dispatchParam"><bean:message key="button.invalid.label" /></html:submit> + + <html:submit property="wrongParam"><bean:message key="parameter.wrong.label" /></html:submit> + </html:form> + <html:form action="lookup-noparam" style="display:inline"> + + <html:submit property="dispatchParam"><bean:message key="parameter.missing.label" /></html:submit> + </html:form> + </p> + + </body> +</html:html> Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/lookup.jsp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/lookup.jsp ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/mapping.jsp URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/mapping.jsp?rev=383716&view=auto ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/mapping.jsp (added) +++ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/mapping.jsp Mon Mar 6 16:04:15 2006 @@ -0,0 +1,69 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %><%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %><%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %><%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %> +<html:html> + <head> + <title><bean:message key="mapping.title" /></title> + <html:base /> + </head> + <body bgcolor="white"> + + <p> + <html:link forward="module-root"><bean:message key="index.home"/></html:link> + + <html:link forward="module-dispatch"><bean:message key="index.title"/></html:link> + </p> + + <hr /> + <p> + <strong>Change Language | Changez Le Langage:</strong> + + <html:link action="/dispatchLocale?language=en">English | Anglais</html:link> + + <html:link action="/dispatchLocale?language=fr">French | Francais</html:link> + </p> + + <hr /> + + <h3><bean:message key="mapping.title" /></h3> + + <logic:messagesPresent> + <html:messages id="msg"> + <p><strong><font color="red"><bean:write name="msg" /></font></strong></p> + </html:messages> + </logic:messagesPresent> + + <logic:messagesPresent message="true"> + <html:messages message="true" id="msg"> + <p><strong><bean:write name="msg" /></strong></p> + </html:messages> + </logic:messagesPresent> + + <logic:messagesNotPresent message="true"> + <logic:messagesNotPresent> + <p> </p> + </logic:messagesNotPresent> + </logic:messagesNotPresent> + + <p> + <html:form action="mapping-foo" style="display:inline"> + <html:submit><bean:message key="button.foo.label" /></html:submit> + </html:form> + + <html:form action="mapping-bar" style="display:inline"> + <html:submit><bean:message key="button.bar.label" /></html:submit> + </html:form> + + <html:form action="mapping-invalid" style="display:inline"> + <html:submit><bean:message key="button.invalid.label" /></html:submit> + </html:form> + + <html:form action="mapping-execute" style="display:inline"> + <html:submit><bean:message key="method.execute.label" /></html:submit> + </html:form> + + <html:form action="mapping-noparam" style="display:inline"> + <html:submit><bean:message key="parameter.missing.label" /></html:submit> + </html:form> + </p> + + </body> +</html:html> Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/mapping.jsp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/dispatch/mapping.jsp ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Modified: struts/action/branches/STRUTS_1_2_BRANCH/web/examples/welcome.jsp URL: http://svn.apache.org/viewcvs/struts/action/branches/STRUTS_1_2_BRANCH/web/examples/welcome.jsp?rev=383716&r1=383715&r2=383716&view=diff ============================================================================== --- struts/action/branches/STRUTS_1_2_BRANCH/web/examples/welcome.jsp (original) +++ struts/action/branches/STRUTS_1_2_BRANCH/web/examples/welcome.jsp Mon Mar 6 16:04:15 2006 @@ -23,6 +23,8 @@ <li><html:link module="/upload" action="/upload">Upload examples</html:link></li> <li><html:link module="/validator" action="/welcome">Validator and Localization examples</html:link></li> + + <li><html:link module="/dispatch" action="/welcome">Dispatch Action examples</html:link></li> </ul> <p>These modules follow the "learn by example" school. Be sure to "look under the hood" to see how it's done.</p> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]