Discussions

XML & Web services: Struts ActionClass method names

  1. Struts ActionClass method names (4 messages)

    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

    Threaded Messages (4)

  2. Struts ActionClass method names[ Go to top ]

    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
  3. Struts ActionClass method names[ Go to top ]

    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.
  4. Struts ActionClass method names[ Go to top ]

    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)
  5. Struts ActionClass method names[ Go to top ]

    Shucks, I was hoping for some popcorn.