Did you enable static method access? The default may have changed. (Is
there a reason the default formatting tags aren't being used? Or the
JSTL format tags?)

Dave

On Thursday, July 21, 2011, Asleson, Ryan <ryan.asle...@biworldwide.com> wrote:
>
> Hello,
>
> We are attempting to upgrade our application from Struts2 version 2.0.11.2 to 
> the current version, 2.2.3.  As part of the upgrade, OGNL was upgraded from 
> version 2.7.3 to version 3.0.1.
>
> Our JSPs make use of OGNL to call static methods on classes to help with 
> formatting.  Here's an example:
>
> <s:property value="@com.example.DateUtils@toDate(promotion.startDate)" />
>
> The DateUtils class has a static toDate method that takes in the passed in 
> promotion.startDate object (which is likely a java.sql.Date) and converts it 
> to a java.util.Date.  It does that so that s:property can properly and 
> uniformly format the date for display.
>
> This had worked before the upgrade from 2.0.11.2 to 2.2.3.  After the 
> upgrade, it no longer works and the s:property tag doesn't output anything.  
> I put some logging statements in the toDate method and it looks like the 
> toDate method is never being called in the first place.
>
> One thing to note is that the DateUtils has two overloaded static toDate 
> methods:  one that takes a String, and the other that takes a Date (or one of 
> its subclasses).  This doesn't seem to make any difference as I've tried 
> changing the method name (and the corresponding OGNL expression) and it still 
> failed to work.
>
> On this page:
>
> http://struts.apache.org/2.2.3/docs/version-notes-211.html
>
> I see this note in the "Backward compatibility issues with previous versions" 
> section:
>
> OGNL method calls like "text(key)" now invoke "text(String)" instead of 
> "getText(String)". This affects method calls only, not properties. Some OGNL 
> expressions may need to be updated.
>
> I'm wondering if this is what is affecting me?  If so, how do I update the 
> OGNL expression so that it works?  I've tried a few things like adding #attr. 
> or simply # to the front of "promotion.startDate" but that didn't seem to 
> work.
>
> Any help is greatly appreciated.  Thank you!!!!
>
> -Ryan
>
>
>
> Ryan Asleson | Application Architect
> BI | Technology Solutions Group
> www.biworldwide.com<http://www.biworldwide.com>
>
> Please consider the environment before printing.
>
>
> This e-mail message is being sent solely for use by the intended recipient(s) 
> and may contain confidential information.  Any unauthorized review, use, 
> disclosure or distribution is prohibited.  If you are not the intended 
> recipient, please contact the sender by phone or reply by e-mail, delete the 
> original message and destroy all copies. Thank you.

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

Reply via email to