Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Subject: ModelDriven vs OGNL assignment?

Subject: ModelDriven vs OGNL assignment?

2007-11-02       - By Gary Affonso

 Back
In our previous WebWork app we were not using ModelDriven and just
relying on OGNL assignment...

* We ensure our action provides a getter for the domain object

  private Account account;
  public Account getAccount();

* We ensure html fieldnames include both the domain object name and the
property

  <input type="hidden" name="account.accountName" value="foo" />

And that does it.  Direct model injection.  Easy.

So my question is this...

Is there any benefit in dealing with the added complexity of
ModelDriven?  It's one more interceptor, and it's one more thing the
action has to implement.  Neither are terribly burdensome but it's more
work than just doing OGNL assignment and I'm wondering why one might go
that way.

Is it a security thing?  I know there are security issues around OGNL
resolution (or there were).  Does ModelDriven do a better job of locking
down what properties are injectable from HTML?

I was hoping, that ModelDriven might be a more elegant way to handle
associations in the targeted domain object.  Since
ModelDrivenInterceptor comes after the ParameterInterceptor, your form
can declare the ID for the associated object and then in your getModel()
method (called after parameter resolution) you've got the opportunity to
resolve those IDs into real object associations before handing off the
model.

But after thinking about it, this isn't any more elegant than how we do
it now.  We basically do the same thing (IDs in the HTML), we just
resolve the associations after the model's other properties are injected
(instead of before).  So that's apparently not of much advantage.

What am I missing?  Why would I use ModelDriven instead?

Thanks!

- Gary

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.