cedric 2002/06/20 09:14:13
Modified: contrib/tiles/web/doc/WEB-INF struts-config.xml
contrib/tiles/src/share/org/apache/struts/tiles/actions
DefinitionDispatcherAction.java
Log:
Let Dispatcher return success or error.
This allow it to work with latest Struts version
Revision Changes Path
1.12 +6 -0 jakarta-struts/contrib/tiles/web/doc/WEB-INF/struts-config.xml
Index: struts-config.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/WEB-INF/struts-config.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- struts-config.xml 24 May 2002 10:16:10 -0000 1.11
+++ struts-config.xml 20 Jun 2002 16:14:13 -0000 1.12
@@ -90,6 +90,12 @@
<forward name="failure" path="test.struts.action.fail"/>
</action>
+ <action path="/test/dispatch"
+ type="org.apache.struts.tiles.actions.DefinitionDispatcherAction"
+ parameter="def">
+ <forward name="success" path="anything" />
+ </action>
+
<!-- ======================================================= -->
<!-- Tutorial Dynamic portal actions -->
<!-- ======================================================= -->
1.2 +17 -9
jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/actions/DefinitionDispatcherAction.java
Index: DefinitionDispatcherAction.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/actions/DefinitionDispatcherAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefinitionDispatcherAction.java 27 Dec 2001 17:41:35 -0000 1.1
+++ DefinitionDispatcherAction.java 20 Jun 2002 16:14:13 -0000 1.2
@@ -34,14 +34,16 @@
* <code>
* <action path="/saveSubscription"
* type="org.apache.struts.tiles.actions.DefinitionDispatcherAction"
- * name="subscriptionForm"
- * scope="request"
- * input="/subscription.jsp"
- * parameter="def"/>
+ * parameter="def"/>
+ * <forward name="success" path="anything" //>
+ * <forward name="error" path="path.to.error.page" //>
* </code>
*
* <p>which will use the value of the request parameter named "def"
* to pick the appropriate definition name.
+ * <p> The value for success doesn't matter. The forward will forward to
+ * appropriate definition.
+ * <p> The value for error should denote a valid jsp path or definition name.
*
* @author Niall Pemberton <[EMAIL PROTECTED]>
* @author Craig R. McClanahan
@@ -96,25 +98,31 @@
{
// Read definition from factory, but we can create it here.
ComponentDefinition definition = DefinitionsUtil.getDefinition( name,
request, getServlet().getServletContext() );
+ System.out.println("get Definition " + definition );
DefinitionsUtil.setActionDefinition( request, definition);
}
catch( FactoryNotFoundException ex )
{
printError( response, "Error - DefinitionDispatcherAction : Can't get
definition factory.");
- return (mapping.findForward(null));
+ return (mapping.findForward("error"));
}
catch( NoSuchDefinitionException ex )
{
printError( response, "Error - DefinitionDispatcherAction : Can't get
definition '" + name +"'.");
- return (mapping.findForward(null));
+ return (mapping.findForward("error"));
}
catch( DefinitionsFactoryException ex )
{
+ printError( response, "Error - DefinitionDispatcherAction : General Factory
error '" + ex.getMessage() +"'.");
+ return (mapping.findForward("error"));
+ }
+ catch( Exception ex )
+ {
printError( response, "Error - DefinitionDispatcherAction : General error
'" + ex.getMessage() +"'.");
- return (mapping.findForward(null));
+ return (mapping.findForward("error"));
}
- return (mapping.findForward(null));
+ return (mapping.findForward("success"));
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>