I don't know if this was the 'right' thing to do, but I extended DispatchAction, overrode the execute method to use the hardcoded value rather than looking up a request parameter, and pass that along to dispatchMethod. My actions then inherit from this modified class. You can safely cut out the lines with ServletContext if you don't care about logging invalid parameters.

Here's the source

/**
   Overrides the execute method of DispatchAction so that rather
   than use the parameter to determine which request parameter
   contains the action to execute, it uses the parameter property
   directly

   @param mapping ActionMapping
   @param form Form associated with action
   @param HttpServletRequest Current request object
   @param HttpServletResponse Current response stream
**/
public ActionForward execute(ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
  throws Exception
  {
    String parameter = mapping.getParameter();
    if (parameter == null) {
        String error = "Could not locate the requested forward";
        ServletContext context = getServlet().getServletContext();
        ServletContextWriter output = new ServletContextWriter(context);
        output.write(error);
        output.flush();
        

response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, error);
        return null;
    }

  return dispatchMethod(mapping, form, request, response, parameter);
  }

--
Nathan Rogers
Library Technology Group
312F Memorial Library
728 State Street
261-1409

Graham Lounder wrote:

Hey all,

After reading the "[Poll] action mappings" thread, I now have a couple of
design questions.  I've got a lot of actions right  now and I'd like to
group related functionality into one action.  I'm thinking of extending the
DispatchAction and creating functions to
search/view/create/update/delete/load my objects.  I'd like to create
separate action mappings for each function.  My question is, can I
"hardcode" my dispatch parameter in the action mapping or do I have to send
it in ever request from the page?

Thanks in advance,
Graham

========================================================================
Graham Lounder - Java Developer
CARIS Spatial Components Division
[EMAIL PROTECTED]
Phone:  (506) 458-8533
Fax:    (506) 459-3849
========================================================================
NO BINDING CONTRACT WILL RESULT FROM THIS EMAIL UNTIL SUCH TIME
AS A WRITTEN DOCUMENT IS SIGNED ON BEHALF OF THE COMPANY.


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


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



Reply via email to