Which version of struts is that? I am using 1.02 and for bean:write, neither type or formatKey are allowed attributes....
It was introduced during the development of Struts 1.1. The Struts development team took great pains to ensure backwards compatibility, and you can probably upgrade to 1.1 with very little (or no) changes to your code.
Otherwise, you'll have to go along with what some other people suggested and instead of displaying the date directly, reference an accessor of a bean which returns a formatted date string.
You can actually subvert the MappedProperty syntax and make a method to which you pass in a date format -- I did this on a project before switching to Struts 1.1. Do something like this:
public class DateWrapper {
private java.util.Date date = null; public DateWrapper (java.util.Date date) { this.date = date; }
public String getFormattedDate(String format) { // typical code to use SimpleDateFormat with the given string // and the 'date' property }
}
Then in your action: request.setAttribute("wrapper", new DateWrapper(date));
Then in your page <bean:write name="wrapper" property="formattedDate(yyyy-MM-dd)" />
Or something more or less like this (i.e. I wrote the above for this email; I didn't copy it from working code).
Of course instead of writing a DateWrapper class you could just add the getFormattedDate method to some bean which has a date property.
But really, you're better off switching to Struts 1.1. Why wouldn't you?
Joe
--
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "If nature worked that way, the universe would crash all the time." --Jaron Lanier
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]