Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

lazy collection invoked by OgnlUtil.java even though not referenced in JSP page

 
Ignacio de Cordoba
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I'm getting the following exception in my JSP page even though the lazy property (siblingCategories) is never invoked or referenced in my JSP page. (I am including an action through s:action into a JSP page)
OgnlUtil.java seems to be invoking all properties in my object. Can I somehow prevent this? I often use EJBs in the page but I look after only invoking eager loading properties, as here. I don't know why OGNL is checking every property in the object and so getting the exception.
Thanks for any ideas or directions,
Ignacio

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's getting referenced *somewhere*, otherwise the getter would not be called.
 
Ignacio de Cordoba
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I've re-checked it and it really is not invoked anyway in the code. The problem seems to be related with the way s:action works; because I'm invoking the same action recursively: They share request environment. First request invokes the Category.action which shows messages and to lists subcategories messages invokes again Category.action with different primary keys as arguments in the s:action tag. I've solved it replacing s:action with sx:div, which makes an AJAX call to the same action. It works ok this way as requests are completely isolated (that is why I am sure nobody is invoking the lazy property there) but makes the browser make multiple HTTP requests (ajax). I wonder if there is any way to completely isolate the "inner" <s:action> from the invoker action environment. Of course, I've set true ignoreContextParams but no difference.

Regards,
Ignacio
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No--that's one of the (several) caveats with the <s:action> tag, and one of the reasons I tend to tell people to avoid it--too many potential "gotchas".
 
Ignacio de Cordoba
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your replies David,
it took me some time till I saw where the problem was. Anyway and forgetting about s:action, can you think of a [better] alternative of using AJAX with or without sx:div (remote div) tag to get included isolated content?

Thanks,
Ignacio
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on the usecase; would a simple jsp:include work? Or a c:include (or whatever it is, I can't recall)?
 
Ignacio de Cordoba
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested these some time ago with a different issue but the problem is usually the same, probably due to the struts2 architecture when different actions invoked share request. I relied on s:action because it, at least, allows to isolate request parameters. The problem is with request objects. I'll give them a try again anyway.

Regards,
Ignacio
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic