Yo ho ho
Following the caffine finally kicking in at the end of my last e-mail I added this code to the top of my Action class (that exends DispatchAction). This seems to work, it checks for the existance of the parameter named in the mapping - if its null it will call the dispatchMethod with my "init" which calls the init method, otherwise it goes on normally... Does anyone wiser than me see issues with doing this? ------------------------------------------------------------------------ ------ public ActionForward execute (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, Exception { ActionForward af = null; HttpSession session = request.getSession(); if (request.getParameter(mapping.getParameter()) == null) { af = dispatchMethod (mapping, form, request, response, "init"); } else { af = super.execute (mapping, form, request, response); } return (af); } ------------------------------------------------------------------------ ----- -----Original Message----- From: Chmura, William B. Sent: Monday, July 29, 2002 11:18 AM To: struts-user Subject: RE: Initialization in a dispatchAction class H'Okay... * I've tried simply adding in another action called startPremadeReports that forwards to: premadeReports.do?action=init Problem is that the premadeReports has validation which fails because you have not been to the form yet * I've tried a globalForward but that has the same problem... * The only thing that works so far is to have a whole different action that is exactly the same without validation. then I am back to needing the action=init on the first call. I would really prefer not to hack the source code for a default setting, but know that I am thinking about it, can I override the execute method or something to check for the parameter, set a default if there is not one there and then forward on to the super.execute method? Hmmmmmmmm -----Original Message----- From: ekbush [mailto:[EMAIL PROTECTED]] Sent: Monday, July 29, 2002 11:06 AM To: struts-user Subject: Re: Initialization in a dispatchAction class [EMAIL PROTECTED] wrote: >Heya, > >I have a number of DispatchAction based classes that run various >reports. They also handle the pre-population of the report request >screen drop down boxes... This is handled currently with an "init" >method. So the first time a screen calls the report selection page is >submits it as: actioname.do?action=init > >I dont like this. I would prefer: > >(1) To institute init as the default method if the parameter is not >present... >(2) Have another action that starts it by transparently calling the >class and adding on the action=init > > >I've played with a bunch of different ways and it all seems to fail >me... > >Any ideas? > Perhaps you could save us the effort of suggesting things you have already tried by telling us what you have tried? :-) -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>