A bit new to all this, only on my 2nd project. Both projects were already in progress so I haven't had to start from scratch (a good thing and a bad thing). I do recall on the 1st project that within the Action classes the methods names were = a parameter(action) set in the form. My current project has one method, 'doExecute' and then has to have a bunch of if's checking the value of 'action'.
How was this done? (can you point me to a good web site or book)
Mucho Thanx,
~r
-
Struts ActionClass method names (4 messages)
- Posted by: Richard Herwig
- Posted on: April 23 2005 18:42 EDT
Threaded Messages (4)
- Struts ActionClass method names by Paul Morie on April 25 2005 12:59 EDT
- Struts ActionClass method names by Rich Hill on April 26 2005 10:15 EDT
- Struts ActionClass method names by Richard Herwig on April 27 2005 11:47 EDT
- Struts ActionClass method names by Rich Hill on April 27 2005 02:00 EDT
- Struts ActionClass method names by Richard Herwig on April 27 2005 11:47 EDT
-
Struts ActionClass method names[ Go to top ]
- Posted by: Paul Morie
- Posted on: April 25 2005 12:59 EDT
- in response to Richard Herwig
Hi Richard-
A good way to handle this is to start by making each task you want to achieve into a seperate action class. You then register each of the action classes with a particular forward in the struts-config.xml file. If you need a decent 'getting started' struts reference, check out 'Programming Jakarta Struts' by Chuck Cavaness.
HTH,
P -
Struts ActionClass method names[ Go to top ]
- Posted by: Rich Hill
- Posted on: April 26 2005 10:15 EDT
- in response to Richard Herwig
For multiple actions that relate to the same business objects or some other logical construct, you may want to consider using the DispatchAction class. It will execute different methods based on a predefined attribute name. Simply set that name to the same as a hidden field in your form and when you submit you'lll have all of th eprocessing done without having to nest 26 if statements. -
Struts ActionClass method names[ Go to top ]
- Posted by: Richard Herwig
- Posted on: April 27 2005 11:47 EDT
- in response to Rich Hill
That's the one... DispatchAction.
thanx M8,
~r
Your reward shall be in heaven ('cause it sure as hell ain't gonna be here ;-)
(thanx to paul also) -
Struts ActionClass method names[ Go to top ]
- Posted by: Rich Hill
- Posted on: April 27 2005 14:00 EDT
- in response to Richard Herwig
Shucks, I was hoping for some popcorn.