Resetting ActionForms from outside the associated Action
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, June 28, 2004 06:03 AM

Hi, here's the situation. I have a LookupDispatchAction for CRUD operations. Naturally, they use the same ActionForm. For a user to update information about the Company's Offices he goes to the menu -> click in "Company's Offices" so he/she is forwared to a JSP that lists all the company offices. Then he click in a specific company office and if forwarded to the CRUD Action wich retrieves data for that company office and pre-populates the ActionForm of that page. Now, the problem starts! If the user goes to the menu again (Note that the Menu is in another Action of course, not in that CRUD Action that i mentioned) and selects the option "Create a new Office", when he is    More>>

Hi,
here's the situation.

I have a LookupDispatchAction for CRUD operations. Naturally, they use the same ActionForm.

For a user to update information about the Company's Offices he goes to the menu -> click in "Company's Offices" so he/she is forwared to a JSP that lists all the company offices.

Then he click in a specific company office and if forwarded to the CRUD Action wich retrieves data for that company office and pre-populates the ActionForm of that page.

Now, the problem starts!

If the user goes to the menu again (Note that the Menu is in another Action of course, not in that CRUD Action that i mentioned) and selects the option "Create a new Office", when he is forwarded to the page of creation (wich is the same as the one for Updating, viewing), this page is already populated with some data (the data i pre-populated when the user decided do View information about that office).

So i need to reset that specific ActionForm everytime the user clicks on "Create a new Office", so the inputs like Office Name, Office Phone, etc.. can be blank for him/her to fill them up with new information.

The point is that i don't know how i can get a reference to the specific ActionForma i want and call it's validate method.

Does anyone know how i can do that???

Regards,
ltcmelo

   <<Less

Re: Resetting ActionForms from outside the associated Action

Posted By:   Sean_Owen  
Posted On:   Monday, June 28, 2004 07:03 AM

The form in question is stored in the user's session, right? You can get at the ActionForm with session.getAttribute(); its key is its "name" from struts-config.xml.
About | Sitemap | Contact