On Wednesday, December 11, 2002, 1:05:36 PM, Jordan wrote:
JT> a) Put all my actions for a particluar area (i.e. creating, editing and JT> deleting user accounts) in one Action class I guess I am in the minority here but lately I've been building one big DispatchAction class that acts as my controller. To me it seems very easy to maintain as each method name in the DispatchAction corresponds to something easy to understand: ie: updateEmployee(... ) insertEmpployee(... ) getEmployees( ... ) Even though this class can become very large it's very simple to work with since a) any decent IDE will show you the methods at a glance in this DispatchAction so it's just as easy to find what you need in the class as it is looking in a directory structure. b) There isn't any business logic in each of the action methods. Each action basically just handles passing the form off to a service object. In my action methods I do stuff like put certain things into request or session scope, create ActionMessages, and figure out what ActionForward to set up. That's about it. The only real drawback that I can see to this approach of one DispatchAction is it prevents other team members from working on some tasks if the one DispatchAction is getting all mucked up. Doesn't seem like a big drawback to me, though since it should only take a minute or two to add a new method to the DispatchAction. The other drawback I find is sometimes if you aren't careful the struts-config file can get confusing, but this is probably do more to my laziness. I say this because, when I can, I try to make one defined Action in the config take several dispatch values. For example I might have a mapping like: <!-- Dispatch values: enterProject,insertProject,updateProject --> <action path="/projects" type="com.outback.taskmanager.actions.TaskManagerAction" name="projectForm" scope="request" validate="true" parameter="dispatch"> <forward name="enterProject" path="/WEB-INF/jsp/projectForm.jsp"/> <forward name="insert-success" path="/WEB-INF/jsp/confirmation.jsp"/> <forward name="update-success" path="/WEB-INF/jsp/confirmation.jsp"/> </action> Notice that if I didn't add the comments above the <action > it could later get confusing what action methods in your DispatchAction correspond to this action mapping. I'd be curious to know if anyone else does something similar or if I'm way off base here. To me it seems like a clean way to do things. Just me 2cents. If the approach above is bad/wrong, please let me know. Thanks, -- Rick mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>