On Tue, 7 Dec 2004 03:59:39 +0000 (UTC), Marc <[EMAIL PROTECTED]> wrote: > Hi there. Help a struts rookie pls. > > I have successfully implemented a two step wizard like interface where I have > A.jsp for the first step and B.jsp for the second step. > > But now I need an ability to dynamically change the jsp file at the step 2 > based on a field selection during step 1 ! > In other words at step two I might need either B.jsp or C.jsp. > All three jsp files post to the same action class but are processed by > different methods(I use DispatchAction and different method names). My problem > is the form bean class. Currently it has getters/setters for all three jsps > and this is exactly what I do not want to do. > > Is there a more elegant way of doing this ? Can I use different form beans and > yet use the same action class ? > > Thanks in advance.
Your problem has various aspects. First, you say that you want to use the same action class to go from A to B or C. That is no problem. This is just a change in the ActionForward. Second, you say that when you have differing destinations or targets (B or C) you want to use different methods to process the data. That is also not a problem. You can use many varieties of methods used to process multiple submits. (I assume, perhaps wrongly, that you define which of B or C is accessed by a choice of submits on the part of the client.) You use DispatchAction. You might want to look at the options on this at http://www.michaelmcgrady.com/button/ and I would recommend in particular the DispatchUtil solution. Third, you talk about wanting different action forms for the differing end destinations or targets, i.e. B or C. This is curious. I am not sure you mean this. The action form is populated by the form on the jsp page A, if you are going to B or C. If your action prepopluates B or C this is not a problem. If B or C have different poplation fields themselves, this is also not a problem. This sort of problem is often asked on the lists, and seems to involve some sort of confusion. Apparently what you want to do is to have two forms on the page A which call the same action and have the same fields but which are intended for different end pages B or C. This does not require two forms. One form can do this without difficulty if you have code in the form access differing methods. You have no need at all of multiple forms, so far as I can tell. Jack -- "You can't wake a person who is pretending to be asleep." ~Native Proverb~ "Each man is good in His sight. It is not necessary for eagles to be crows." ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]