I want to convert my
JSP page to
servlets. I will outline the JSP code I wish to convert, and then propose some suggestions.
Here is what the code does:
- Checks to see if this is a fresh page load, or a repost
- If it is a repost, checks to see if the account to be created is valid (performs database check to see if the account already exists)
- If it is valid, creates the account with a database insert call and redirects the page to a welcome page
- If it is not valid, or if it is a fresh page load, draw the page itself which consists of a form
So now I would ask:
- How would you break it into servlets?
- Would each database query be in its own servlet?
- Would you put the drawing of the html into the servlet as well? Into a different servlet?