i was encounter this problem when i update the Struts2 from version 2.3.15 to 2.3.32. At version 2.3.32 , <s:property value="(new java.text.SimpleDateFormat().format())">
could not be parsed,and no error. So, how to resolve this problem?
Instead of writing ugly OGNL expression in property tag, that even doesn't work, why not to create a property/method in action class that does format the value.
How to format dates and numbers:
A frequently asked question is how best to display dates and numbers using a specified format. There are a number of approaches for this, the most naive of which would be to add a method to your action class to do the formatting for you. This method would take in a
Date
(or subclass) object as a parameter, and return a formattedString
.