I am already using DispatchAction. I didn't use the scope in my action-mapping. Instead I use session.setAttribute in my Action.
The codes to update the actionform is in action1. But I need to update the same form in action2. One way is to duplicate the same codes in both action. Or the common update codes can be executed before a JSP is loaded. The latter will prevent duplicate codes. sebastian On Wed, 2004-08-25 at 14:26, Rick Reumann wrote: > Sebastian Ho wrote: > > > Hi > > > > Scenario : > > > > 1. User submits form in JSP1 which Action1 saves to database. > > 2. Action1 set Form1 into session. > > 3. Action1 forwards to JSP1 again, which is suppose to display newly > > added form with other forms previously added. > > > > How do I make JSP1 to get values from database BEFORE JSP1 displays and > > set them into session? I suppose I have to do this in Action1 but for > > the first submission of form1, Action1 is not called yet by JSP1. > > > >>From my analysis, there will be situation where there will be multiple > > input sources into a particular JSP. That means I need to have my > > 'update from database and set in session' codes in all the Action > > classes that forwards to JSP1? > > > > In another words, how do I call the update method in Action1 from > > Action2 before forwarding to the JSP which display my updated data. > > > > This is duplication of codes and inefficient to me. There must be a > > better way to do this in Struts. > > > > My question might be confusing..I am trying my best. Tell me if its > > unclear. > > It's unclear:) > > Some of you terminology might just be wrong which is making it more > confusing. For example in step 2 above, are you setting the form in > session scope yourself? You normally don't need, or want, to manually do > this. You delcare the scope of your form in your action mapping. > > I think what you are wondering about is "How do you get your form > populate for your JSP so that that user can alter it?" (I could be wrong > here)... anyway I like to use a DispatchAction which has several methods > in it... setUp, Update, etc. So your first call when the user clicks on > a link would call the setUp method and there you would make sure your > form is populated with the data it needs and you forward to your JSP. As > a side note, you do not need to be using Session scope for this. Do you > have a particular reason why you need to be using Session scope for your > form (many times you do, but I'm guessing in this case you don't and you > are using the Session because you are not understanding the flow of how > Struts operates). > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]