You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Riaan Oberholzer <ri...@yahoo.com> on 2003/08/06 14:29:34 UTC
[Q] Struts and date formatters
I am using the <bean:write> tag and for date fields
(java.util.Date), I get the (rather ugly) full:
Wed Aug 06 12:08:07 CEST 2003
I have tried to do:
DateFormdat df = DateFormat.getDateTimeInstance();
SimpleDateFormat sdf = (SimpleDateFormat)df;
sdf.applyPattern("yyyy-MM-dd hh:mm");
But it gets ignored.... how/where can I change the
default pattern that struts uses to format dates with?
Thanks.
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Mark Galbreath <ma...@qat.com>.
And you specify the format in your application.properties file.
-----Original Message-----
From: Joe Germuska [mailto:Joe@Germuska.com]
Sent: Wednesday, August 06, 2003 8:49 AM
To: Struts Users Mailing List
Subject: Re: [Q] Struts and date formatters
Somewhere between 1.0 and 1.1, the "format" attribute was added to
the <bean:write> tag. You can specify a format string and it will
apply the format to the underlying object. The tag has internal
logic which determines which kind of formatter to create, but
basically if your object is a Date, it will use a SimpleDateFormatter:
http://jakarta.apache.org/struts/userGuide/struts-bean.html#write
There's no global change you can make here, besides subclassing
java.util.Date and overriding the toString() method.
Joe
At 5:29 -0700 8/6/03, Riaan Oberholzer wrote:
>I am using the <bean:write> tag and for date fields (java.util.Date), I
>get the (rather ugly) full:
>
>Wed Aug 06 12:08:07 CEST 2003
>
>I have tried to do:
>
>DateFormdat df = DateFormat.getDateTimeInstance(); SimpleDateFormat sdf
>= (SimpleDateFormat)df; sdf.applyPattern("yyyy-MM-dd hh:mm");
>
>But it gets ignored.... how/where can I change the
>default pattern that struts uses to format dates with?
>
>Thanks.
>
>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
--
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"If nature worked that way, the universe would crash all the time."
--Jaron Lanier
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: [Q] Struts and date formatters
Posted by Joe Germuska <Jo...@Germuska.com>.
Somewhere between 1.0 and 1.1, the "format" attribute was added to
the <bean:write> tag. You can specify a format string and it will
apply the format to the underlying object. The tag has internal
logic which determines which kind of formatter to create, but
basically if your object is a Date, it will use a SimpleDateFormatter:
http://jakarta.apache.org/struts/userGuide/struts-bean.html#write
There's no global change you can make here, besides subclassing
java.util.Date and overriding the toString() method.
Joe
At 5:29 -0700 8/6/03, Riaan Oberholzer wrote:
>I am using the <bean:write> tag and for date fields
>(java.util.Date), I get the (rather ugly) full:
>
>Wed Aug 06 12:08:07 CEST 2003
>
>I have tried to do:
>
>DateFormdat df = DateFormat.getDateTimeInstance();
>SimpleDateFormat sdf = (SimpleDateFormat)df;
>sdf.applyPattern("yyyy-MM-dd hh:mm");
>
>But it gets ignored.... how/where can I change the
>default pattern that struts uses to format dates with?
>
>Thanks.
>
>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
--
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"If nature worked that way, the universe would crash all the time."
--Jaron Lanier
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Riaan Oberholzer <ri...@yahoo.com>.
It is/was a known bug for WL 6.1 sp2. If you like more
info on it, do a google search for "CR064391".
A patch was realeased for this bug
(CR064391_610sp2.jar) and it is fixed as of sp3. But
we cannot upgrade or install patched, for a number of
reasons.
So, if you use WL 6.1 sp2 without patches, you are
limited with the number of jars you import. In
particular, the total length of the names of all the
jars (and sub-jars they use) cannot exceed 80
characters.
--- Joe Germuska <Jo...@Germuska.com> wrote:
> At 7:05 -0700 8/6/03, Riaan Oberholzer wrote:
> >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.
>
> We run all of our client applications on WL6.1sp3
> and almost all of
> them run Struts 1.1. I don't know if this was fixed
> between sp2 and
> sp3; this is the first I've heard of that bug. I'm
> not saying you're
> wrong -- just saying here's a case of someone in a
> similar
> environment doing what you want to be doing.
>
> Joe
>
> --
> --
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
> "If nature worked that way, the universe would crash
> all the time."
> --Jaron Lanier
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Joe Germuska <Jo...@Germuska.com>.
At 7:05 -0700 8/6/03, Riaan Oberholzer wrote:
>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.
We run all of our client applications on WL6.1sp3 and almost all of
them run Struts 1.1. I don't know if this was fixed between sp2 and
sp3; this is the first I've heard of that bug. I'm not saying you're
wrong -- just saying here's a case of someone in a similar
environment doing what you want to be doing.
Joe
--
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"If nature worked that way, the universe would crash all the time."
--Jaron Lanier
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Riaan Oberholzer <ri...@yahoo.com>.
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 <Jo...@Germuska.com> 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
> Joe@Germuska.com
> http://blog.germuska.com
> "If nature worked that way, the universe would crash
> all the time."
> --Jaron Lanier
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Joe Germuska <Jo...@Germuska.com>.
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
Joe@Germuska.com
http://blog.germuska.com
"If nature worked that way, the universe would crash all the time."
--Jaron Lanier
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by bm...@gmx.de.
1.1
> Which version of struts is that? I am using 1.02 and
> for bean:write, neither type or formatKey are allowed
> attributes....
>
>
> --- bmoritz@gmx.de wrote:
> > There is a "struts way" of doing it (at least, I
> > think, it's the struts
> > way). You just have to declare the parameter of your
> > bean as a java.util.Date and
> > have a property named
> > org.apache.struts.taglib.bean.format.date in your
> > standard properties file, e.g.
> > org.apache.struts.taglib.bean.format.date=dd.MM.yy.
> > The same works for numbers, too. You can also
> > specify your own property by
> > using the formatKey-Property of the bean:write-Tag
> >
>
(http://localhost:8080/struts-documentation/userGuide/struts-bean.html#write)
> >
> > Björn
> >
> > > OK, thanks, I'll look into it.
> > >
> > > I was hoping for a default struts way to do it,
> > but it
> > > seems I have to do it "by hand".
> > >
> > >
> > >
> > > --- Alex Shneyderman <al...@law.columbia.edu>
> > wrote:
> > > > Well the other way is what you are doing already
> > > > except instead of
> > > > attaching the bean as a date attach it as a
> > > > preformatted string. Using
> > > > the same SimpleDateFormat.
> > > >
> > > > The reason you are getting your "strangely"
> > > > formatted string is because
> > > > JSP does yourBean.toString () hence the behavior
> > you
> > > > are seeing.
> > > >
> > > > Alex.
> > > >
> > > > > -----Original Message-----
> > > > > From: Riaan Oberholzer
> > > > [mailto:riaanoberholzer@yahoo.com]
> > > > > Sent: Wednesday, August 06, 2003 8:41 AM
> > > > > To: Struts Users Mailing List;
> > > > alex@law.columbia.edu
> > > > > Subject: RE: [Q] Struts and date formatters
> > > > >
> > > > > Is there a solution without using JSTL? I run
> > on
> > > > BEA
> > > > > WebLogic 6.1sp2 and there is a known bug which
> > > > limits
> > > > > the number of external jars you can import
> > into an
> > > > > application. Do a google search for
> > > > > CR064391_610sp2.jar for more details on that.
> > > > >
> > > > > Anyway, we cannot upgrade to a new version
> > soon,
> > > > which
> > > > > means we have to reduce the number of libs we
> > > > import.
> > > > > It sucks, but its reality. :(
> > > > >
> > > > >
> > > > >
> > > > > --- Alex Shneyderman <al...@law.columbia.edu>
> > > > wrote:
> > > > > > Use JSTL's formatDate tag. Very easy to use
> > and
> > > > lets
> > > > > > you format your
> > > > > > date any way you want it. Example:
> > > > > >
> > > > > > <fmt:formatDate value="${yourDate}"
> > > > > > pattern="yyyy-MM-dd HH:mm" />
> > > > > >
> > > > > > it is that simple.
> > > > > > Alex.
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Riaan Oberholzer
> > > > > > [mailto:riaanoberholzer@yahoo.com]
> > > > > > > Sent: Wednesday, August 06, 2003 8:30 AM
> > > > > > > To: struts-user@jakarta.apache.org
> > > > > > > Subject: [Q] Struts and date formatters
> > > > > > >
> > > > > > > I am using the <bean:write> tag and for
> > date
> > > > > > fields
> > > > > > > (java.util.Date), I get the (rather ugly)
> > > > full:
> > > > > > >
> > > > > > > Wed Aug 06 12:08:07 CEST 2003
> > > > > > >
> > > > > > > I have tried to do:
> > > > > > >
> > > > > > > DateFormdat df =
> > > > DateFormat.getDateTimeInstance();
> > > > > > > SimpleDateFormat sdf =
> > (SimpleDateFormat)df;
> > > > > > > sdf.applyPattern("yyyy-MM-dd hh:mm");
> > > > > > >
> > > > > > > But it gets ignored.... how/where can I
> > change
> > > > the
> > > > > > > default pattern that struts uses to format
> > > > dates
> > > > > > with?
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > > __________________________________
> > > > > > > Do you Yahoo!?
> > > > > > > Yahoo! SiteBuilder - Free, easy-to-use web
> > > > site
> > > > > > design software
> > > > > > > http://sitebuilder.yahoo.com
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> > > > > > struts-user-unsubscribe@jakarta.apache.org
> > > > > > > For additional commands, e-mail:
> > > > > > struts-user-help@jakarta.apache.org
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > > > struts-user-unsubscribe@jakarta.apache.org
> > > > > > For additional commands, e-mail:
> > > > > > struts-user-help@jakarta.apache.org
> > > > > >
> > > > >
> > > > >
> > > > > __________________________________
> > > > > Do you Yahoo!?
> > > > > Yahoo! SiteBuilder - Free, easy-to-use web
> > site
> > > > design software
> > > > > http://sitebuilder.yahoo.com
> > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > struts-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > > > struts-user-help@jakarta.apache.org
> > > >
> > > >
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > struts-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > > struts-user-help@jakarta.apache.org
> > > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! SiteBuilder - Free, easy-to-use web site
> > design software
> > > http://sitebuilder.yahoo.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > >
> >
> > --
> > COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
> > --------------------------------------------------
> > 1. GMX TopMail - Platz 1 und Testsieger!
> > 2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
> > 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de -
> > 7. daybyday - 8. e-Post
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
> === message truncated ===
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
--
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--------------------------------------------------
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Riaan Oberholzer <ri...@yahoo.com>.
Which version of struts is that? I am using 1.02 and
for bean:write, neither type or formatKey are allowed
attributes....
--- bmoritz@gmx.de wrote:
> There is a "struts way" of doing it (at least, I
> think, it's the struts
> way). You just have to declare the parameter of your
> bean as a java.util.Date and
> have a property named
> org.apache.struts.taglib.bean.format.date in your
> standard properties file, e.g.
> org.apache.struts.taglib.bean.format.date=dd.MM.yy.
> The same works for numbers, too. You can also
> specify your own property by
> using the formatKey-Property of the bean:write-Tag
>
(http://localhost:8080/struts-documentation/userGuide/struts-bean.html#write)
>
> Bj�rn
>
> > OK, thanks, I'll look into it.
> >
> > I was hoping for a default struts way to do it,
> but it
> > seems I have to do it "by hand".
> >
> >
> >
> > --- Alex Shneyderman <al...@law.columbia.edu>
> wrote:
> > > Well the other way is what you are doing already
> > > except instead of
> > > attaching the bean as a date attach it as a
> > > preformatted string. Using
> > > the same SimpleDateFormat.
> > >
> > > The reason you are getting your "strangely"
> > > formatted string is because
> > > JSP does yourBean.toString () hence the behavior
> you
> > > are seeing.
> > >
> > > Alex.
> > >
> > > > -----Original Message-----
> > > > From: Riaan Oberholzer
> > > [mailto:riaanoberholzer@yahoo.com]
> > > > Sent: Wednesday, August 06, 2003 8:41 AM
> > > > To: Struts Users Mailing List;
> > > alex@law.columbia.edu
> > > > Subject: RE: [Q] Struts and date formatters
> > > >
> > > > Is there a solution without using JSTL? I run
> on
> > > BEA
> > > > WebLogic 6.1sp2 and there is a known bug which
> > > limits
> > > > the number of external jars you can import
> into an
> > > > application. Do a google search for
> > > > CR064391_610sp2.jar for more details on that.
> > > >
> > > > Anyway, we cannot upgrade to a new version
> soon,
> > > which
> > > > means we have to reduce the number of libs we
> > > import.
> > > > It sucks, but its reality. :(
> > > >
> > > >
> > > >
> > > > --- Alex Shneyderman <al...@law.columbia.edu>
> > > wrote:
> > > > > Use JSTL's formatDate tag. Very easy to use
> and
> > > lets
> > > > > you format your
> > > > > date any way you want it. Example:
> > > > >
> > > > > <fmt:formatDate value="${yourDate}"
> > > > > pattern="yyyy-MM-dd HH:mm" />
> > > > >
> > > > > it is that simple.
> > > > > Alex.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Riaan Oberholzer
> > > > > [mailto:riaanoberholzer@yahoo.com]
> > > > > > Sent: Wednesday, August 06, 2003 8:30 AM
> > > > > > To: struts-user@jakarta.apache.org
> > > > > > Subject: [Q] Struts and date formatters
> > > > > >
> > > > > > I am using the <bean:write> tag and for
> date
> > > > > fields
> > > > > > (java.util.Date), I get the (rather ugly)
> > > full:
> > > > > >
> > > > > > Wed Aug 06 12:08:07 CEST 2003
> > > > > >
> > > > > > I have tried to do:
> > > > > >
> > > > > > DateFormdat df =
> > > DateFormat.getDateTimeInstance();
> > > > > > SimpleDateFormat sdf =
> (SimpleDateFormat)df;
> > > > > > sdf.applyPattern("yyyy-MM-dd hh:mm");
> > > > > >
> > > > > > But it gets ignored.... how/where can I
> change
> > > the
> > > > > > default pattern that struts uses to format
> > > dates
> > > > > with?
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > > __________________________________
> > > > > > Do you Yahoo!?
> > > > > > Yahoo! SiteBuilder - Free, easy-to-use web
> > > site
> > > > > design software
> > > > > > http://sitebuilder.yahoo.com
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > > struts-user-unsubscribe@jakarta.apache.org
> > > > > > For additional commands, e-mail:
> > > > > struts-user-help@jakarta.apache.org
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > > struts-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > > > > struts-user-help@jakarta.apache.org
> > > > >
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Yahoo! SiteBuilder - Free, easy-to-use web
> site
> > > design software
> > > > http://sitebuilder.yahoo.com
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > struts-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > struts-user-help@jakarta.apache.org
> > >
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > > struts-user-help@jakarta.apache.org
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> > http://sitebuilder.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> >
>
> --
> COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
> --------------------------------------------------
> 1. GMX TopMail - Platz 1 und Testsieger!
> 2. GMX ProMail - Platz 2 und Preis-Qualit�tssieger!
> 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de -
> 7. daybyday - 8. e-Post
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
=== message truncated ===
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by bm...@gmx.de.
There is a "struts way" of doing it (at least, I think, it's the struts
way). You just have to declare the parameter of your bean as a java.util.Date and
have a property named org.apache.struts.taglib.bean.format.date in your
standard properties file, e.g.
org.apache.struts.taglib.bean.format.date=dd.MM.yy. The same works for numbers, too. You can also specify your own property by
using the formatKey-Property of the bean:write-Tag
(http://localhost:8080/struts-documentation/userGuide/struts-bean.html#write)
Björn
> OK, thanks, I'll look into it.
>
> I was hoping for a default struts way to do it, but it
> seems I have to do it "by hand".
>
>
>
> --- Alex Shneyderman <al...@law.columbia.edu> wrote:
> > Well the other way is what you are doing already
> > except instead of
> > attaching the bean as a date attach it as a
> > preformatted string. Using
> > the same SimpleDateFormat.
> >
> > The reason you are getting your "strangely"
> > formatted string is because
> > JSP does yourBean.toString () hence the behavior you
> > are seeing.
> >
> > Alex.
> >
> > > -----Original Message-----
> > > From: Riaan Oberholzer
> > [mailto:riaanoberholzer@yahoo.com]
> > > Sent: Wednesday, August 06, 2003 8:41 AM
> > > To: Struts Users Mailing List;
> > alex@law.columbia.edu
> > > Subject: RE: [Q] Struts and date formatters
> > >
> > > Is there a solution without using JSTL? I run on
> > BEA
> > > WebLogic 6.1sp2 and there is a known bug which
> > limits
> > > the number of external jars you can import into an
> > > application. Do a google search for
> > > CR064391_610sp2.jar for more details on that.
> > >
> > > Anyway, we cannot upgrade to a new version soon,
> > which
> > > means we have to reduce the number of libs we
> > import.
> > > It sucks, but its reality. :(
> > >
> > >
> > >
> > > --- Alex Shneyderman <al...@law.columbia.edu>
> > wrote:
> > > > Use JSTL's formatDate tag. Very easy to use and
> > lets
> > > > you format your
> > > > date any way you want it. Example:
> > > >
> > > > <fmt:formatDate value="${yourDate}"
> > > > pattern="yyyy-MM-dd HH:mm" />
> > > >
> > > > it is that simple.
> > > > Alex.
> > > >
> > > > > -----Original Message-----
> > > > > From: Riaan Oberholzer
> > > > [mailto:riaanoberholzer@yahoo.com]
> > > > > Sent: Wednesday, August 06, 2003 8:30 AM
> > > > > To: struts-user@jakarta.apache.org
> > > > > Subject: [Q] Struts and date formatters
> > > > >
> > > > > I am using the <bean:write> tag and for date
> > > > fields
> > > > > (java.util.Date), I get the (rather ugly)
> > full:
> > > > >
> > > > > Wed Aug 06 12:08:07 CEST 2003
> > > > >
> > > > > I have tried to do:
> > > > >
> > > > > DateFormdat df =
> > DateFormat.getDateTimeInstance();
> > > > > SimpleDateFormat sdf = (SimpleDateFormat)df;
> > > > > sdf.applyPattern("yyyy-MM-dd hh:mm");
> > > > >
> > > > > But it gets ignored.... how/where can I change
> > the
> > > > > default pattern that struts uses to format
> > dates
> > > > with?
> > > > >
> > > > > Thanks.
> > > > >
> > > > > __________________________________
> > > > > Do you Yahoo!?
> > > > > Yahoo! SiteBuilder - Free, easy-to-use web
> > site
> > > > design software
> > > > > http://sitebuilder.yahoo.com
> > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > struts-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > > > struts-user-help@jakarta.apache.org
> > > >
> > > >
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > struts-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > > struts-user-help@jakarta.apache.org
> > > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! SiteBuilder - Free, easy-to-use web site
> > design software
> > > http://sitebuilder.yahoo.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
--
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--------------------------------------------------
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Riaan Oberholzer <ri...@yahoo.com>.
OK, thanks, I'll look into it.
I was hoping for a default struts way to do it, but it
seems I have to do it "by hand".
--- Alex Shneyderman <al...@law.columbia.edu> wrote:
> Well the other way is what you are doing already
> except instead of
> attaching the bean as a date attach it as a
> preformatted string. Using
> the same SimpleDateFormat.
>
> The reason you are getting your "strangely"
> formatted string is because
> JSP does yourBean.toString () hence the behavior you
> are seeing.
>
> Alex.
>
> > -----Original Message-----
> > From: Riaan Oberholzer
> [mailto:riaanoberholzer@yahoo.com]
> > Sent: Wednesday, August 06, 2003 8:41 AM
> > To: Struts Users Mailing List;
> alex@law.columbia.edu
> > Subject: RE: [Q] Struts and date formatters
> >
> > Is there a solution without using JSTL? I run on
> BEA
> > WebLogic 6.1sp2 and there is a known bug which
> limits
> > the number of external jars you can import into an
> > application. Do a google search for
> > CR064391_610sp2.jar for more details on that.
> >
> > Anyway, we cannot upgrade to a new version soon,
> which
> > means we have to reduce the number of libs we
> import.
> > It sucks, but its reality. :(
> >
> >
> >
> > --- Alex Shneyderman <al...@law.columbia.edu>
> wrote:
> > > Use JSTL's formatDate tag. Very easy to use and
> lets
> > > you format your
> > > date any way you want it. Example:
> > >
> > > <fmt:formatDate value="${yourDate}"
> > > pattern="yyyy-MM-dd HH:mm" />
> > >
> > > it is that simple.
> > > Alex.
> > >
> > > > -----Original Message-----
> > > > From: Riaan Oberholzer
> > > [mailto:riaanoberholzer@yahoo.com]
> > > > Sent: Wednesday, August 06, 2003 8:30 AM
> > > > To: struts-user@jakarta.apache.org
> > > > Subject: [Q] Struts and date formatters
> > > >
> > > > I am using the <bean:write> tag and for date
> > > fields
> > > > (java.util.Date), I get the (rather ugly)
> full:
> > > >
> > > > Wed Aug 06 12:08:07 CEST 2003
> > > >
> > > > I have tried to do:
> > > >
> > > > DateFormdat df =
> DateFormat.getDateTimeInstance();
> > > > SimpleDateFormat sdf = (SimpleDateFormat)df;
> > > > sdf.applyPattern("yyyy-MM-dd hh:mm");
> > > >
> > > > But it gets ignored.... how/where can I change
> the
> > > > default pattern that struts uses to format
> dates
> > > with?
> > > >
> > > > Thanks.
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Yahoo! SiteBuilder - Free, easy-to-use web
> site
> > > design software
> > > > http://sitebuilder.yahoo.com
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > struts-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > struts-user-help@jakarta.apache.org
> > >
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > > struts-user-help@jakarta.apache.org
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> > http://sitebuilder.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Alex Shneyderman <al...@law.columbia.edu>.
Well the other way is what you are doing already except instead of
attaching the bean as a date attach it as a preformatted string. Using
the same SimpleDateFormat.
The reason you are getting your "strangely" formatted string is because
JSP does yourBean.toString () hence the behavior you are seeing.
Alex.
> -----Original Message-----
> From: Riaan Oberholzer [mailto:riaanoberholzer@yahoo.com]
> Sent: Wednesday, August 06, 2003 8:41 AM
> To: Struts Users Mailing List; alex@law.columbia.edu
> Subject: RE: [Q] Struts and date formatters
>
> Is there a solution without using JSTL? I run on BEA
> WebLogic 6.1sp2 and there is a known bug which limits
> the number of external jars you can import into an
> application. Do a google search for
> CR064391_610sp2.jar for more details on that.
>
> Anyway, we cannot upgrade to a new version soon, which
> means we have to reduce the number of libs we import.
> It sucks, but its reality. :(
>
>
>
> --- Alex Shneyderman <al...@law.columbia.edu> wrote:
> > Use JSTL's formatDate tag. Very easy to use and lets
> > you format your
> > date any way you want it. Example:
> >
> > <fmt:formatDate value="${yourDate}"
> > pattern="yyyy-MM-dd HH:mm" />
> >
> > it is that simple.
> > Alex.
> >
> > > -----Original Message-----
> > > From: Riaan Oberholzer
> > [mailto:riaanoberholzer@yahoo.com]
> > > Sent: Wednesday, August 06, 2003 8:30 AM
> > > To: struts-user@jakarta.apache.org
> > > Subject: [Q] Struts and date formatters
> > >
> > > I am using the <bean:write> tag and for date
> > fields
> > > (java.util.Date), I get the (rather ugly) full:
> > >
> > > Wed Aug 06 12:08:07 CEST 2003
> > >
> > > I have tried to do:
> > >
> > > DateFormdat df = DateFormat.getDateTimeInstance();
> > > SimpleDateFormat sdf = (SimpleDateFormat)df;
> > > sdf.applyPattern("yyyy-MM-dd hh:mm");
> > >
> > > But it gets ignored.... how/where can I change the
> > > default pattern that struts uses to format dates
> > with?
> > >
> > > Thanks.
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! SiteBuilder - Free, easy-to-use web site
> > design software
> > > http://sitebuilder.yahoo.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Riaan Oberholzer <ri...@yahoo.com>.
Is there a solution without using JSTL? I run on BEA
WebLogic 6.1sp2 and there is a known bug which limits
the number of external jars you can import into an
application. Do a google search for
CR064391_610sp2.jar for more details on that.
Anyway, we cannot upgrade to a new version soon, which
means we have to reduce the number of libs we import.
It sucks, but its reality. :(
--- Alex Shneyderman <al...@law.columbia.edu> wrote:
> Use JSTL's formatDate tag. Very easy to use and lets
> you format your
> date any way you want it. Example:
>
> <fmt:formatDate value="${yourDate}"
> pattern="yyyy-MM-dd HH:mm" />
>
> it is that simple.
> Alex.
>
> > -----Original Message-----
> > From: Riaan Oberholzer
> [mailto:riaanoberholzer@yahoo.com]
> > Sent: Wednesday, August 06, 2003 8:30 AM
> > To: struts-user@jakarta.apache.org
> > Subject: [Q] Struts and date formatters
> >
> > I am using the <bean:write> tag and for date
> fields
> > (java.util.Date), I get the (rather ugly) full:
> >
> > Wed Aug 06 12:08:07 CEST 2003
> >
> > I have tried to do:
> >
> > DateFormdat df = DateFormat.getDateTimeInstance();
> > SimpleDateFormat sdf = (SimpleDateFormat)df;
> > sdf.applyPattern("yyyy-MM-dd hh:mm");
> >
> > But it gets ignored.... how/where can I change the
> > default pattern that struts uses to format dates
> with?
> >
> > Thanks.
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> > http://sitebuilder.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Riaan Oberholzer <ri...@yahoo.com>.
I have used JSTL and found it very nice, but then I
have to export the property somehow from the struts
bean to jstl... right? How do I do it?
I use (in simplistic form):
<logic:iterate id="employee" name="listOfEmployees">
<bean:write name="employee" property="birthdate">
</logic:iterate>
How would this translate to (I assume) a combination
with JSTL?
--- Alex Shneyderman <al...@law.columbia.edu> wrote:
> Use JSTL's formatDate tag. Very easy to use and lets
> you format your
> date any way you want it. Example:
>
> <fmt:formatDate value="${yourDate}"
> pattern="yyyy-MM-dd HH:mm" />
>
> it is that simple.
> Alex.
>
> > -----Original Message-----
> > From: Riaan Oberholzer
> [mailto:riaanoberholzer@yahoo.com]
> > Sent: Wednesday, August 06, 2003 8:30 AM
> > To: struts-user@jakarta.apache.org
> > Subject: [Q] Struts and date formatters
> >
> > I am using the <bean:write> tag and for date
> fields
> > (java.util.Date), I get the (rather ugly) full:
> >
> > Wed Aug 06 12:08:07 CEST 2003
> >
> > I have tried to do:
> >
> > DateFormdat df = DateFormat.getDateTimeInstance();
> > SimpleDateFormat sdf = (SimpleDateFormat)df;
> > sdf.applyPattern("yyyy-MM-dd hh:mm");
> >
> > But it gets ignored.... how/where can I change the
> > default pattern that struts uses to format dates
> with?
> >
> > Thanks.
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> > http://sitebuilder.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [Q] Struts and date formatters
Posted by Alex Shneyderman <al...@law.columbia.edu>.
Use JSTL's formatDate tag. Very easy to use and lets you format your
date any way you want it. Example:
<fmt:formatDate value="${yourDate}" pattern="yyyy-MM-dd HH:mm" />
it is that simple.
Alex.
> -----Original Message-----
> From: Riaan Oberholzer [mailto:riaanoberholzer@yahoo.com]
> Sent: Wednesday, August 06, 2003 8:30 AM
> To: struts-user@jakarta.apache.org
> Subject: [Q] Struts and date formatters
>
> I am using the <bean:write> tag and for date fields
> (java.util.Date), I get the (rather ugly) full:
>
> Wed Aug 06 12:08:07 CEST 2003
>
> I have tried to do:
>
> DateFormdat df = DateFormat.getDateTimeInstance();
> SimpleDateFormat sdf = (SimpleDateFormat)df;
> sdf.applyPattern("yyyy-MM-dd hh:mm");
>
> But it gets ignored.... how/where can I change the
> default pattern that struts uses to format dates with?
>
> Thanks.
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org