PILGRIM, Peter, FM wrote:
In the current API 1.1 beta3 which has changed.

I have an Action `Preloader' but I what to create or get another a reference
to Action `Activate'. What is the best way to do this.

public class Preloader extends DispatchAction {
public void execute( ... ) {

ActionServlet servlet = getServlet();
RequestProcessor processor = servlet.getRequestProcessor();

Action activateAction = processor.createActionCreate();

}
}

Unfortunately the `ActionServlet.getRequestProcessor' call is protected.
What I was to do is prepopulate the action form that is associated with `Activate' action mapping ?

ActivateForm = magic_api.getActionForm( "/activate" );
activateForm.setSymbol("alpha");

Then I can dispatch forward to the activate mapping.

This is sort of like action chaining but difference.

Any ideas on the new best practice?

--
Peter Pilgrim,
Struts/J2EE Consultant, RBoS FM, Risk IT
Tel: +44 (0)207-375-4923

At work I couldn't remember for the life of me how I did this before.
I got legacy code at home that shows how to pass settings to
a second action.

The answer was to define a local forward in the `Preloader'
action with the path of the next second action `Activate'


<action path="/preloader" name="preloaderForm"
	scope="session"
        validate="false" >
	
	...

	<forward name="processSelect" path="/activate?action=processData" />

	...
	<parameter name="action" />
</action>



<action path="/activate" name="activateForm"
	scope="session"
        validate="false" >
	
	...

	<parameter name="action" />
</action>


In the `Preloader.processSelect()' you set any parameters in the request scope

class Preloader extends Action

	ActionForward processSelect(...) {

		request.setAttribute("firstName", "Michael" );
		request.setAttribute("lastName", "Jackson" );

		return mapping.findForward("processSelect" )
	}
}


In the `Activate.processData' retrieve the values from the request scope and
set the them yourself in the action form.

class Activate extends Action

	ActionForward processSelect(...) {

		form.setFirstName( request.setAttribute("firstName"));
		form.setLastName( request.setAttribute("lastName"));

		return mapping.findForward("processSelect" )
	}
}


Now I have wait until I go back to work tomorrow.  !Bastardo!
Ah, the trials and tribulations of consulting.



Craig's idea of chaining of responsiblity pattern for Struts Action is needed
right here and right now.

I would still like to know how to retreve a list of a web application
`Actions' object from inside `Action.execute()' call. Any ideas?

--
Peter Pilgrim
       __ _____	_____ _____
      / //__  // ___// ___/   +	 Serverside Java
     / /___/ //	/__ / /__     +  Struts
    / // ___// ___// ___/     +  Expresso Committer
 __/ // /__ / /__ / /__       +  Independent Contractor
/___//____//____//____/	      +  Intrinsic Motivation
On Line Resume
   ||
   \\===>  `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to