wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts2 POJO population from URL 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 "Struts2 POJO population from URL" Watch "Struts2 POJO population from URL" New topic
Author

Struts2 POJO population from URL

James Jithin
Greenhorn

Joined: Mar 08, 2011
Posts: 2
I have a Java Object with many other nested Objects and lists of Objects. When the request arrives from the client, I see that the Object is populated only to a few levels. Is there any configuration that sets this is Struts 2? Here is my example.



When I call the `populate` method and when send to the jsp, the iteration happens good with all the elements. But, when I try to update, i.e. when then form is submitted, the `update()` method is called, but the instance variable abc does not get populated completely.

I have seen the url which is passed and everything seems to be fine. Let me tell you what happens. The url will be something like (splitting with line break for easy understanding here),



In this case, the `defList` inside `abc` and `ghi.ghiName` in `abc` are populated with no issues. But the `defList` of `abc.ghi` is not populated. Is this a common behavior of Struts 2? Is there any means by which this can be overridden?
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Use preperable interface and override prepare method in your action class. And add it to interceptors. This interceptor is very useful for any situation where you need to ensure some logic runs before the actual execute method runs.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 POJO population from URL