Hi Martin,
I think you should generate the input to the generic module, rather than passing the ActionForm directly:From this JSP I want to access a (hopefully) generic module to get the access points. This "module" has to get some information (e. g. a region to prefilter the addresses or access points already existing) from JSP1.
// get data from ActionForm1 needed to look up addresses AddressLookupInfo info = getAddressInfoFromActionForm1(AF1);
// lookup addresses List res = AddressLookup.getAddresses(info); ...
Then your module can still be generic.
I could take the necessary information from AF1 to some POJO (or bean) onYou shouldn't need to split each action into two. Action1's job is to handle the input from ActionForm1, and then do the setup to display JSP2, right? So, just create the ActionForm2 manually inside Action1:
model level (or controller level) and transfer it to AF2. This is probably
the "cleanest" solution but means to split each action into two, just to do
the data transfer.
// Create AF2 as an input/output form ActionForm2 af2 = new ActionForm2(); session.setAttribute("actionForm2", af2);
// ... and pre-populate it with the data the user has already input ActionForm1 af1 = (ActionForm1) getActionForm(mapping, form, request, session); af2.loadDataFromAF1(af1);
// forward control to JSP2 return (mapping.findForward("jsp2"));
My current solution simply accesses both action forms, AF1 and AF2 (gettingI guess it depends on whether you consider the two forms to represent one logical command or two logical commands.
the one not available as the "form"-parameter by MyForm mf = (MyForm)session.getAttribute("AFi");
but my feeling is that this is not really good style.
The other thing to consider, though, is whether or not you want to store the ActionForms at session scope. Session scope is problematic because you might end up accessing old data (if the user previously quit in the middle of a wizard). Also, I imagine things would fail in a distributed application where the user's requests are randomly routed to multiple servers. The alternative is to use request level scope, but in this case the information entered in Form#1 has to be embedded in the output of JSP2 as hidden HTML variables.
Bill
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]