aspose file tools*
The moose likes JSP and the fly likes Model 1 or Model 2 architecture? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Model 1 or Model 2 architecture?" Watch "Model 1 or Model 2 architecture?" New topic
Author

Model 1 or Model 2 architecture?

Joseph Smithern
Ranch Hand

Joined: Feb 11, 2006
Posts: 89
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

Joined: Jan 10, 2002
Posts: 61238
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Model 1 or Model 2 architecture?