mraible wrote:
Following up months later as this has come up again now that 2.1 is close to
release. The current version does log messages for invalid properties, but
it doesn't blow up for invalid properties which is more of what I'm looking
for.

Hi Matt,
I'm not convinced that you really want what you say you want.

Sure, if you use:
<s:property name="prop"/>
You want to see a message in the log stating that the property didn't exist. Fair enough.

However, if you use:
<s:property name="prop" default="a"/>
Then I presume you don't want a message in the log if property didn't exist. But OGNL doesn't know about the default attribute.

Similarly in FTL if you used:
${parameters.nameValue}?default("a")
You wouldn't want a warning from the framework if nameValue doesn't exist because freemarker will handle that if you don't provide a default.

Quite clearly, when setting a property it's the framework's responsibility to report if the property didn't exist. But whose responsibility is it to report that an attempt to read a property was made but the property didn't exist. I'm sure many algorithms depending on silent failure so they can provide a default. My opinion is that it's best handled in the view and FTL has the best implementation of this (particularly in 2.4.x where there's improved handling for nulls and blanks).
When I blogged about this[1], one of the responses was the following:



When you are using freemarker as your result technology in struts2 you get
great feedback on problems like this. This is not indicative of the whole
framework -- just the result-type that you are using (probably jsp?)


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.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to