S
sasuke
Hello to all Java programmers out there.
I am currently trying to create a very simple form which would store
the data entered by the user in a database, but I would like to be
sure that I make use of the best practices in J2EE and that too
*without* using any framework out there; just plain old JSP/Servlets.
My action plan is something like:
"Create a simple HTML login form. Create a form bean. When the form is
submitted, redirect to a controller servlet which pulls the form
values and creates a form bean out of this. Set this bean in the
session scope. Call the validate function on this bean.
If validation succeeds, pass the bean instance to a DAO class (Data
Access Object) which can persist in into the database/any other
persistent storage and destroy the bean from the session scope. If
validation fails, pass a error bean / a list of error messages back to
the same page. Use the bean stored in the session to restore the
values which were correctly filled and display the contents of error
bean / list. Use JSTL for conditional branching and looping".
Is there a better way of doing this or are there any flaws with my
approach? Any comments would be really appreciated.
Thanks and regards,
~/sasuke
I am currently trying to create a very simple form which would store
the data entered by the user in a database, but I would like to be
sure that I make use of the best practices in J2EE and that too
*without* using any framework out there; just plain old JSP/Servlets.
My action plan is something like:
"Create a simple HTML login form. Create a form bean. When the form is
submitted, redirect to a controller servlet which pulls the form
values and creates a form bean out of this. Set this bean in the
session scope. Call the validate function on this bean.
If validation succeeds, pass the bean instance to a DAO class (Data
Access Object) which can persist in into the database/any other
persistent storage and destroy the bean from the session scope. If
validation fails, pass a error bean / a list of error messages back to
the same page. Use the bean stored in the session to restore the
values which were correctly filled and display the contents of error
bean / list. Use JSTL for conditional branching and looping".
Is there a better way of doing this or are there any flaws with my
approach? Any comments would be really appreciated.
Thanks and regards,
~/sasuke