tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Jacobson <marti...@libero.it>
Subject Re: Defining methods in JSP pages
Date Mon, 14 Oct 2002 08:07:25 GMT
Craig R. McClanahan wrote:

> The biggest problem with the general approach you suggest is that you are
> mixing Java logic into your pages, which means you need a Java programmer
> to maintain them.  A much better strategy is to use a
> model-view-controller (MVC) style architecture that has back-end business
> logic setting up the dynamic things your page needs in request attributes
> or session attributes, and then forward to the page (which can use things
> like <jsp:getProperty> to grab them.  An example of a framework for MVC
> style development is Struts <http://jakarta.apache.org/struts>.
> 
> An additional benefit of banishing scriptlets from your pages is that the
> JSP page compiler can generate better code, as well as handling bigger and
> more complex pages.  The general trend in modern JSP development is away
> from scriptlets.
> 


Another solution (which I use) is to not use JSPs at all - just servlets 
with the Velocity template engine <http://jakarta.apache.org/velocity>. 
Velocity allows a very clean separation between the business logic and 
the presentation. No weird syntax, no Java in the HTML to confuse Web 
designers, no run-time translation/compilation.

Martin



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message