• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Model 1 or Model 2 architecture?

 
Joseph Smithern
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic