Hi I have four different buttons on the JSP: Save, Submit, Return and Close. These four buttons will save different data to the database.
Then how to write my action classes. Should I write seperate action class for every button OR One main action class and seperate methods for every button.
Extend org.apache.struts.actions.DispatchAction, set parameter to method (or whatever) in struts-config.xml.
Html Submit buttons should be named method (or whatever) in the page.
When Struts processes it will call the appropriate method in the Action, methods should use same signature as execute, but, name them save, reset or whatever.
Do not go the route of hidden fields to handle this.
A popular method of handling multiple button isdescribed here with a link to LookupDispatchAction's javadoc, which has very good documentation. [ August 12, 2005: Message edited by: Marc Peabody ]
Hi Sudhakar, do you set the value of the hidden field using javascript? I had been having problem with using javascript with struts...Could you please provide sample code? [ August 12, 2005: Message edited by: michelle Wang ]