This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Please advise if what I am doing would be considered good practice and fall under the MVC pattern?
I have a JSP with a Form where values are submitted by a user. The JSP is submitted to a Servlet where the Servlet decides what to do with the info. The Servlet calls Java classes to do stuff depending on what was entered in the JSP Form. For example if the user didnt enter all the values or there were validation issues the Servlet would call a Validator JavaBean class and then redirect the user to a JSP with the validation errors. If the user enters valid data the Servlet would call another Java class with SQL insert statements to insert the info into the database.
I dont have Struts in my Tomcat 4.1.3 containre so I am using Scriptlets with JavaBeans on the JSP to show information. [ November 01, 2007: Message edited by: Joseph Smithern ]
Sounds right to me. Since you are using JSP 1.2 (Tomcat 4), you can use only JSTL 1.0, so it may be necessary to use some scriptlets on the page. Just be careful not to let the scriplets get out of control and start doing work that's best done in the controllers.
I'd advise a move to JSP 2.0 (Tomcat 5+) as soon as you are able and to ditch all scriplets on the pages in favor of JSTL 1.1 and JSP 2.0 EL.