Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 POJO population from URL

 
James Jithin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic