lazy collection invoked by OgnlUtil.java even though not referenced in JSP page
Ignacio de Cordoba
Greenhorn
Joined: Jan 04, 2010
Posts: 13
posted
0
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
It's getting referenced *somewhere*, otherwise the getter would not be called.
Ignacio de Cordoba
Greenhorn
Joined: Jan 04, 2010
Posts: 13
posted
0
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.
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
Joined: Jan 04, 2010
Posts: 13
posted
0
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?
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
Joined: Jan 04, 2010
Posts: 13
posted
0
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
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: lazy collection invoked by OgnlUtil.java even though not referenced in JSP page