If I wanted to create an app to add users to a database, then I would need a "UserForm" form-bean to store the user data from the JSP web-page form. A UserAction servlet/class to see what function we wanted from the JSP web-page (add as opposed to retrieve, delete, update). And lastly, I would need a DTO to handle the data transfer to/from the database to/from the UserForm form-bean.
I'm going to play around with this this week, and see what happens. I love all your ideas, and I am going to make use of them. I am glad that I am keeping within the Struts ideals rather than go down the wrong road.
As we both know ... once you get one form down, if I do a bunch of these it will just become routine, and then I'll expand on my Struts knowledge to try new things.
Thanks again for all the help.
Tom
Erik Weber wrote:
e) if there is an error, then we should return false to the action class so we can take the action as defined in the struts-config.xml file.
You can do this, but I prefer to return String or void and throw Exceptions from the "backend" to the Action class, rather than returning true or false, from CRUD methods. True or false gives you two explanations. Using Exceptions gives you an infinite number of explanations. Matter of preference I guess. But you can also take advantage of Struts' declarative Exception handling with this approach, which is a great part of Struts.
Not that you can't return boolean and also throw an Exception. ;) I guess what I meant was, I like to think of a business operation as possibly having several types of failure (Exceptions), rather than just one type ("false"). Throwing different types of Exceptions at the Struts Exception handler and configuring each type in struts-config.xml is an easy way to support this strategy.
Erik
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]