I cannot switch to Sturts 1.1 because I use BEA WebLogic 6.1sp2 and a known WL bug limits the number of total jars you can use in an application to a collective name length of 80 characters. :( Same reason why I also cannot use JSTL.
Since struts 1.1 imports a few more new jars, I exceed the limit and the app doesn't work anymore. But I have found enough suggestions and hints from all of you to implement a suitable workaround, thank you! For other projects not using WL 6.1sp2, I have already upgraded to Struts 1.1. Haven't done the date thing there yet, as I do it with JSTL there. --- Joe Germuska <[EMAIL PROTECTED]> wrote: > At 6:28 -0700 8/6/03, Riaan Oberholzer wrote: > >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] > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]