wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts 2, OGNL and data abstraction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2, OGNL and data abstraction" Watch "Struts 2, OGNL and data abstraction" New topic
Author

Struts 2, OGNL and data abstraction

Peter Searls
Greenhorn

Joined: Dec 21, 2009
Posts: 9
Hi,

It is my understanding that in Struts 1 we abstracted the data from the J2EE view by copying the data from a form bean to a pojo/dto and that one of the nice additions in Struts 2 is that the OGNL language does that abstraction for you by transferring the data from the form to attributes in the action or a bean you specify. Because of this belief I designed my application this way and now the programmers I work with are telling me that I am wrong and that the system needs to be changed (expensively) to add in the abstraction layer.

So the question is, am I wrong and should just accept it and take the hit to my reputation or am I correct and I should stop them before they make a mess of things. I can accept it if I'm wrong but it doesn't feel that way.

Any help would be appreciated.

Thanks,

Pete


Peter Searls
psearls@hollandamerica.com
Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

You are correct. I am currently working on a large online application with a few hundred fields in a java object. The object is saved on the session and when new fields are updated and the client clicks save the application is loaded from the session, the appropriate fields are updated by Struts, and the fields are saved to the database.

In Struts 1 we had the tedious task of updating the object from the form fields. In Struts 2 you access the object directly in the action class.
Peter Searls
Greenhorn

Joined: Dec 21, 2009
Posts: 9
Thanks Richard.

The more replies the better to convince my management/co-workers, so keep'em coming
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

You are correct but without knowing your full architecture who knows why they may be saying what they are saying. I've worked for clients that even though this feature exists they still have Data Objects for the Presentation tier and end up transferring their data from that DO to some other Data Object because it was how they had their Struts1 applications so now they dont want to refractor any DAOs or Hibernate etc ... so each situation can be weird in its own way ...
Peter Searls
Greenhorn

Joined: Dec 21, 2009
Posts: 9
Thanks Lucas,

I worked on the old struts 1 version and the new struts 2 version. Unfortunately the problem is that a CONSULTANT was brought in to see what we might be doing wrong. Instead of talking to us, the technical leads who designed the system he decided to meet with a contractor who helped us. That contractor understood the basics of struts 2 but not the nuance of what OGNL provided. So the CONSULTANT who admits he doesn't know struts 2 took all of his input from a contractor who really doesn't know struts 2 ;~D

I don't know about where you work but at my company it seems that outsiders are automatically assumed to know more than the people who have worked there for years.

Pete
 
wood burning stoves
 
subject: Struts 2, OGNL and data abstraction