I have a 1.0 struts-based web application where a "higher-level" action 
depends on the processing associated with another lower-level action.

For example, action "foo" needs to invoke the processing
associated with action "bar".

Using struts 1.0, I could do the following in the FooAction:

  ActionServletMine actionServlet = 
      (ActionServletMine)mapping.getMappings().getServlet();
  ActionMapping targetMapping = actionServlet.findMapping("/bar.do");
  ((BarAction)actionServlet.getActionInstance(
      targetMapping)).perform(targetMapping, form, request, response);

ActionServletMine is my own subclass of ActionServlet. It simply provides
the extra method "getActionInstance()" to allow me to get access to the
action instance associated with "targetMapping". (it calls 
processActionCreate()).

Migrating to struts 1.1, I was hoping for backwards compatibility,
but ActionMapping.getMappings() seems to have been removed without
being first deprecated. Any reason, or am I missing something?
(btw, I know I could simply call getServlet() within the Action subclass,
but I'm still curious as to why getMappings() has been removed).


If I am to bite the bullet right now and rearchitect the
webapp with the new struts 1.1 api, I still run into a few
issues. 

What I've described above is how I thought would be the proper way
to handle "action calling other action" in the very early days of 1.0. 
There might be a better approach now. If so, I'd appreciate if someone
could point me in the right direction.

If I am to simply migrate the above code to the new 1.1 apis, 
it appears that I'd have to do the following:

  ActionServlet actionServlet = getServlet();
  ApplicationConfig appConfig = mapping.getApplicationConfig();
  RequestProcessor rp = actionServlet.getRequestProcessor(appConfig);

It appears that "findMapping()" has been deprecated. So the code
    ActionMapping targetMapping = actionServlet.findMapping("/bar.do");
should be replaced by
    ActionConfig targetAction = appConfig.findActionConfig() 

The problem though is that the execute() method of an Action expects
an ActionMapping object... which means that I'm back to want to use the old
1.0 api to get an ActionMapping (or I'm once again missing something). 
How come the new execute() method of Action does not take an ActionConfig 
object as argument instead of the old ActionMapping?

Finally, it would be preferable to migrate to the new RequestProcessor interface.
However, ActionServlet.getRequestProcessor() is protected,
preventing me from accessing it from my Action code. 
Any reason why it is not public?

Many thanks for any answer/advice...

    -- Pierre

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

Reply via email to