Struts recognizes certain object types as listed in the Built in Type Conversion Support section for the documentation and as explained in the linked answer by Andrea.
If you're wondering why your Date object render as m/d/yy
format even though you are using an <s:property>
tag instead of an <s:date>
tag, it's because Date is one of the types that Struts2 has built-in conversion for.
So instead of calling the default toString()
method of the Date object, Struts2 will use the built-in type converters to display the String.
In the com.opensymphony.xwork2.conversion.impl.StringConverter
class, Struts2 will attempt to convert the Date object to a String in a meaningful way using the default format for the Locale as mentioned by Andrea and the documentation.