I am not sure if I would do this like you did. There are is a certain lifecycle contract between every Cocoon component and the container. By invoking directly you may be violating this contract. I would probably let the sitemap do the forwarding to actions. In your case action sets might be good. http://xml.apache.org/cocoon/userdocs/concepts/actions.html
Alternatively you can use one dispatcher action which inherits from AbstractXMLFormAction and works directly with the backend based on the requested command. Yet another alternative is for the extending action to return an objectmodel parameter which is matched later in the sitemap. <map:action type="myxmlformaction"> ... <map:call src="cocoon:{whichaction}"> Ivelin ----- Original Message ----- From: "Josema Alonso" <[EMAIL PROTECTED]> To: "Cocoon-Users" <[EMAIL PROTECTED]> Sent: Thursday, November 07, 2002 11:53 AM Subject: Re: how to manage several XMLForms in a sitemap? (it was: dynamically choosing an action at runtime) > Well, this is a followup to my previous message regarding this subject. > I coded the Dispatcher, but I must say I didn't know what I was doing > exactly. Surprisingly, it works but only from time to time...the behaviour > is really weird... > I'm copying the code below and hope someone could review it. I'm afraid I'm > breaking something somewhere in my cocoon... > > Thanks. > > ps: remember that I was trying to code a Action that could dispatch other > actions, so I could call it for as many XMLForms as needed with a parameter > and it would choose the right action. Some kind of factory method... > > ----------------------- > package net.josema.xmtrader.forms; > > import java.util.HashMap; > import java.util.Map; > > import > net.josema.xmtrader.forms.xmldb.recordings.equipment.EquipmentTypeAction; > import org.apache.avalon.framework.parameters.Parameters; > import org.apache.avalon.framework.thread.ThreadSafe; > import org.apache.cocoon.acting.ConfigurableComposerAction; > import org.apache.cocoon.environment.Redirector; > import org.apache.cocoon.environment.SourceResolver; > > > /** > * This action let decide which action to use at runtime based on > * a sitemap parameter with the name of the action to load. > * > */ > public class ActionDispatcher extends ConfigurableComposerAction implements > ThreadSafe { > > public Map act(Redirector redirector, SourceResolver resolver, Map > objectModel, > String source, Parameters parameters) > throws Exception { > > String actionName = parameters.getParameter("actionName"); > Map resultMap = new HashMap(); > > //get the Action > if(actionName.equalsIgnoreCase("EquipmentTypeAction")) { > EquipmentTypeAction equipmentTypeAction = new EquipmentTypeAction(); > //add this action to the manager > equipmentTypeAction.compose(this.manager); > resultMap = equipmentTypeAction.act(redirector, resolver, objectModel, > source, parameters); > } > //place for the rest of the if clauses for more actions > > //return the map gotten from the chosen action > return resultMap; > } > } > > > > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>