struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mraible <m...@raibledesigns.com>
Subject Re: How can I tell Struts 2 to throw/log exceptions for invalid OGNL Expressions
Date Sun, 13 Apr 2008 16:29:50 GMT



Jeromy Evans - Blue Sky Minds wrote:
> 
> Jeromy Evans wrote:
>> mraible wrote:
>>
>>>
>>> I tried FreeMarker this morning and discovered that the problem 
>>> exists there
>>> too. Grrr. I've experienced Struts 2 being eliminated as a web framework
>>> candidate on a couple projects because of this. Kindof annoying.
>>>   
>>
>> So what do you really want?  My guess here is that you invoked a 
>> struts tag and the tag swallowed the error and provided a default to 
>> the freemarker template.
>>
>>
> 
> On further thought I think this comes down to an interesting issue with 
> coupling between the view and the model.
> In struts2 the model is a ValueStack that consists of both a stack and 
> map (context).  OGNL is used to address properties or methods in that 
> model and it's a trivial for OGNL to log when it fails to match a 
> property or method.
> 
> In the view, Struts2 provides tags for jsp, ftl or velocity that 
> evaluate OGNL expressions to access the model.  More often that not the 
> tags fail silently if the expression was invalid or failed to evaluate 
> anything.  Herein lies the problem. 
> 
> If I were using FTL directly to access the value stack, as a developer I 
> could decide how to handle missing properties, blank properties or 
> default values with FTL's excellent error handling.  However, when I use 
> FTL to invoke a Struts2 tag I lose that benefit as the tag 
> implementations *transfer* properties into the FTL context. I think its 
> a flaw that Struts2 tags evaluate OGNL expressions themselves prior to 
> rendering the template.. 
> 
> A tag overhaul is well overdue (but major effort).  I've expressed other 
> concerns about the Struts2 tags (XWork Component and UIBean) on several 
> occasions already.
> 

I realize it might be a major effort, but this seems to be a pretty big deal
to me. Not for users that've already chosen Struts 2 as a web framework, but
for folks evaluating Java Web Frameworks. The fact that Struts 2 is the
*only* one that doesn't blow up on invalid properties makes it look pretty
bad for evaluations. It's kindof like the old blank page you'd sometimes get
with Tiles - you really have no idea what you did wrong and it can take
quite some time to track it down if you don't know what's causing it.

Matt
-- 
View this message in context: http://www.nabble.com/How-can-I-tell-Struts-2-to-throw-log-exceptions-for-invalid-OGNL-Expressions-tp11659700p16659934.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message