On Thu, 11 Nov 2004 10:42:27 +0100, Rosenberg, Leon
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> since we started talking about paradigms... how does JSTL and especially
> EL fit into MVC paradigm?
> 

Much of JSTL is clearly about view tier stuff -- things like
conditionals and looping to dynamically include or repeat elements,
are totally related to dynamically creating the markup.  The same
thing can be said of things like the XML manipulation, if you're doing
things like user-specific stylesheet transformations and the like.

Other parts of JSTL (such as the SQL tags) are designed for model 1
style programs, and are not really as directly useful in an MVC style
design.

> Or, the better question, why does struts support EL nowadays, when it
> breaks the paradigm?

The way that Struts supports EL is as a *binding* between view tier
things (the custom tags that are creating the dynamic markup) and the
model tier things (your DAOs or VOs or whatever containing the model
data).  You have to have a binding somewhere ... my experience is that
using binding expressions is the most concise way to say things, and
puts the decision in the hands of the appropriate person (the page
author knows that she is creating the "name" field, and therefore
knows what to bind to.

Interestingly, JSTL's expressions are primarily about "pull" of data
from the model.  JSF, which uses essentially the same paradigm for
binding, also uses the expression to "push" data (after any needed
conversion and validation) back to the model.  Therefore, an
expression like:

  <h:inputText id="name" value="#{customer.name}"/>

is used at two different times:

* When the page is rendered, pull the data from the customer bean
  (doing any necessary conversions on the way).

* When the form is submitted, and after any conversions and validations
  have been performed successfully, push the data back to the model.

This binding activity plays pretty much the same role that ActionForm
beans do in Struts, but without the need for an extra class.

> 
> Regards
> 
> Leon
> 
> 

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to