I'm still a Struts newbie, but I have some confusion on the amount of classes I need to use in order to create a CRUD application.

From what I can see I need a "form bean" in order to capture the data from the JSP page. This contains the validate method which would verify some of the data from the JSP page. I also need an "Action" class/servlet that captures the action ... so if I had Add, Update, or Delete button, the Acttion class/servlet would handle the action.

Now, there is also the "bean" itself sometimes which has a 'DTO' in the name. I guess this is for "Data Transfer Object" which handles the create, retrieve, update, and delete database actions.

So, I'm a little unsure about the whole sequence of actions within struts, but here is what I want to do when I add a record.
1) calls the action class/servlet execute method
2) calls the formbean class so it can validate if the data is ok
3) if there are errors return to the page configured in struts
4) if there are NO errors
a) then instantiate the DTO class (so we can update the database)
b) Instantiate the form itself which contains data we got from the JSP page
c) pass in the "formbean" into the DTO class, so we can transer the data to the DTO from the "formbean"
d) call the insert method within the DTO class to file the data to the database
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.


If this is correct, or sort of correct, please let me know so I can adjust my thought process. Thanks for any information you can provide.

Thanks.

                        Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to