Ralph,
I'm currently implementing the Model 2 architechture in a web based application.
The application configures all of the customers, mailboxes, users, and trading
partner relationships for our e-commerce application (on a MSSQL 7 Server).
The model I use, uses Beans for all data processing and database access.
Servlets for data routing (ie processing Post's and such) and JSP's for data
presentation and gathering. This works quite well for me. So, in answer to your
question... I would put all of you sql queries into a (JDBC enabled) bean and
then access the bean via your jsp pages (via the jsp:useBean and jsp:getProperty
tags)
Matt Goss

Ralph Fiol wrote:

> I've been trying to find a "great" example of a Model 2 Architecture
> implementation.  So far, I've not had much luck.  This article from
> JavaWorld comes pretty close, but lacks some important implementation
> details.  The article is:
>
> http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc_p.html
>
> What the article fails to describe is how to best architect a *real-world*
> e-commerce application.  If you look at the EShop.jsp file in the example,
> the author has hard-coded the catalog list, rather than pulling that
> information from a database.  While it is easy enough to throw in a
> <jrun:sql> tag, that would violate the Model 2 design.  And in a real-world
> e-commerce application, the home page would most likely also contain
> additional database content such as featured products, a product category
> list, and maybe top-sellers.
>
> The article goes on to say that Servlets should act as the controller, using
> beans to model the data, then forward to JSP pages to display results (act
> as views).  That makes good sense, but the example he presents uses the
> servlet only to respond to events such as FORM posts and URL links.  The
> home page is just a simple JSP page.  So, if we we're to update ESHop.jsp to
> generate the content from a database, how would we do that?
>
> - Use a bean to get the data from a database?  Maybe have a SiteBean that
> returns a vector of ProductBeans (for featured products)?
>
> - Call a servlet from within the JSP page?
>
> Has anyone come across a good example of how to do this?  Or, does anyone
> have any suggestions on how to modify the example?
>
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to