locale specific date format

2003-11-21 Thread Nathan Coast
Hi

How do I set locale specific date formats?  I tried setting 
org.apache.struts.taglib.bean.format.date with format strings within locale 
specific applicationResources.properties but the format keeps coming out the same

Fri Nov 21 16:46:05 CST 2003

any ideas?

cheers
Nathan
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: locale specific date format

2003-11-21 Thread Rick Reumann
Nathan Coast wrote:

How do I set locale specific date formats?  I tried setting 
org.apache.struts.taglib.bean.format.date with format strings within 
locale specific applicationResources.properties but the format keeps 
coming out the same

Fri Nov 21 16:46:05 CST 2003

any ideas?
For displaying on a JSP page? You can use JSTL...

fmt:setLocale value='en-US'/
fmt:formatDate value='${dateVariable}'/
or set the pattern based on a locale and then...

fmt:formatDate value='${dateVariable}' pattern='${datePattern}'/

Probably the JSTL Master Kris Schneeder could chime in here with a 
better way. I could be way off.

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: locale specific date format

2003-11-21 Thread Kris Schneider
Schneeder? Hm, sounds familiar, but... Anyway, forgetting JSTL for a second
(gasp!), you're saying you've got something like:

ApplicationResources_en.properties:
dateFormat=...

ApplicationResources_fr.properties:
dateFormat=...

Yes? If so, then maybe this is what you're looking for:

bean:write name=dateObj formatKey=dateFormat/

This will use the current Struts locale, or you can add the locale attribute
to specify the name of a session attribute for the locale you'd prefer.

Quoting Rick Reumann [EMAIL PROTECTED]:

 Nathan Coast wrote:
 
  How do I set locale specific date formats?  I tried setting 
  org.apache.struts.taglib.bean.format.date with format strings within 
  locale specific applicationResources.properties but the format keeps 
  coming out the same
  
  Fri Nov 21 16:46:05 CST 2003
  
  any ideas?
 
 For displaying on a JSP page? You can use JSTL...
 
 fmt:setLocale value='en-US'/
 fmt:formatDate value='${dateVariable}'/
 
 or set the pattern based on a locale and then...
 
 fmt:formatDate value='${dateVariable}' pattern='${datePattern}'/
 
 Probably the JSTL Master Kris Schneeder could chime in here with a 
 better way. I could be way off.
 
 -- 
 Rick

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: locale specific date format

2003-11-21 Thread Rick Reumann
Kris Schneider wrote:

Schneeder? Hm, sounds familiar, 
he he sorry about that Kris:) Just don't beat me... you were sort of a 
bad ass as the superintendent on One Day At A Time.:)

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: locale specific date format

2003-11-21 Thread Kris Schneider
Yipes, that's dated...

Quoting Rick Reumann [EMAIL PROTECTED]:

 Kris Schneider wrote:
 
  Schneeder? Hm, sounds familiar, 
 
 he he sorry about that Kris:) Just don't beat me... you were sort of a 
 bad ass as the superintendent on One Day At A Time.:)
 
 -- 
 Rick

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Date format

2003-08-01 Thread Silverio Wagner Silva(Secorp)
A beginner question:

When my date field is shown in my jsp it appears in a different way,
although my Locale object is correctly set.

Anyone knows how to solve this problem?

Thanks.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Date format

2003-08-01 Thread Tamia Ramírez
with type is your date, java.sql or java.util?

-Original Message-
From: Silverio Wagner Silva(Secorp) [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 10:27 AM
To: 'Struts Users Mailing List'
Subject: Date format


A beginner question:

When my date field is shown in my jsp it appears in a different way,
although my Locale object is correctly set.

Anyone knows how to solve this problem?

Thanks.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RES: Date format

2003-08-01 Thread Silverio Wagner Silva(Secorp)
java.util.Date

-Mensagem original-
De: Tamia Ramírez [mailto:[EMAIL PROTECTED] 
Enviada em: sexta-feira, 1 de agosto de 2003 13:33
Para: Struts Users Mailing List
Assunto: RE: Date format

with type is your date, java.sql or java.util?

-Original Message-
From: Silverio Wagner Silva(Secorp) [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 10:27 AM
To: 'Struts Users Mailing List'
Subject: Date format


A beginner question:

When my date field is shown in my jsp it appears in a different way,
although my Locale object is correctly set.

Anyone knows how to solve this problem?

Thanks.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Date format

2003-08-01 Thread Tamia Ramírez
THIS CODE BECOME A JAVA.UTIL.DATE WITH FORMAT: dd/MM/ to a date MMM dd,
:

SimpleDateFormat dateFormatter = new SimpleDateFormat(MMM dd, );
String new_Date = dateFormatter.format(myDate);
reservacion.setFechaSalString(new_Date);

you may need to import java.text first.

I hope it can help to you too... it works for me.

-Original Message-
From: Silverio Wagner Silva(Secorp) [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 10:33 AM
To: 'Struts Users Mailing List'
Subject: RES: Date format


java.util.Date

-Mensagem original-
De: Tamia Ramírez [mailto:[EMAIL PROTECTED]
Enviada em: sexta-feira, 1 de agosto de 2003 13:33
Para: Struts Users Mailing List
Assunto: RE: Date format

with type is your date, java.sql or java.util?

-Original Message-
From: Silverio Wagner Silva(Secorp) [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 10:27 AM
To: 'Struts Users Mailing List'
Subject: Date format


A beginner question:

When my date field is shown in my jsp it appears in a different way,
although my Locale object is correctly set.

Anyone knows how to solve this problem?

Thanks.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Date format

2003-08-01 Thread Daniel H. F. e Silva
Hi all,

  Well, i recommend using JSTL tag formatNumber with type='currency'.
You can do this way:

  %@ taglib uri=http://java.sun.com/jstl/fmt; prefix=fmt %

  fmt:setLocale value=pt_BR/
  fmt:formatNumber value=${your_property} type=currency/

  It worked for me.

Regards,
 Daniel Silva


--- Tamia_Ramírez [EMAIL PROTECTED] wrote:
 THIS CODE BECOME A JAVA.UTIL.DATE WITH FORMAT: dd/MM/ to a date MMM dd,
 :
 
 SimpleDateFormat dateFormatter = new SimpleDateFormat(MMM dd, );
 String new_Date = dateFormatter.format(myDate);
 reservacion.setFechaSalString(new_Date);
 
 you may need to import java.text first.
 
 I hope it can help to you too... it works for me.
 
 -Original Message-
 From: Silverio Wagner Silva(Secorp) [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 01, 2003 10:33 AM
 To: 'Struts Users Mailing List'
 Subject: RES: Date format
 
 
 java.util.Date
 
 -Mensagem original-
 De: Tamia Ramírez [mailto:[EMAIL PROTECTED]
 Enviada em: sexta-feira, 1 de agosto de 2003 13:33
 Para: Struts Users Mailing List
 Assunto: RE: Date format
 
 with type is your date, java.sql or java.util?
 
 -Original Message-
 From: Silverio Wagner Silva(Secorp) [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 01, 2003 10:27 AM
 To: 'Struts Users Mailing List'
 Subject: Date format
 
 
 A beginner question:
 
 When my date field is shown in my jsp it appears in a different way,
 although my Locale object is correctly set.
 
 Anyone knows how to solve this problem?
 
 Thanks.
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 -
 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]



RE: date format problems

2003-03-07 Thread apachep2
Never try to store a date as a string. It creates a lot of date format
problems. As I have said, store it as a long so that you can easily do
the conversion.

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED] 
Sent: March 6, 2003 6:42 PM
To: 'Struts Users Mailing List'
Subject: SV: date format problems

Hi.
Thanks for all the answers

I was trying different things because nothing would work for me.

I need one thing:

Convert the String value theForm.GetMyDate() so that I can insert it in
my sql as -MM-dd.

I get the error java.lang.IllegalArgumentException: Cannot format given
Object as a Date

I will look at BeanUtils.copyProperties( beanToCopyTo, beanCopyingFrom
);, but it is probably to complicated for me just now!

What is the best way to fix it?

-Oprindelig meddelelse-
Fra: Chen, Gin [mailto:[EMAIL PROTECTED] 
Sendt: 6. marts 2003 16:31
Til: 'Struts Users Mailing List'
Emne: RE: date format problems

The standard for an actionForm is to have every field as String.
All conversion (which should really be thought of as business logic)
should
occur in the Action classes or further down the food chain. If this is
not
possible in your case or does not solve what your working on then can
you
please give more details?
-Tim


-Original Message-
From: Kandi Potter [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:21 AM
To: Struts Users Mailing List
Subject: RE: date format problems


I'm no expert at struts but I  convert and validate my dates in my
Action or
Business Class instead of the Form.  I could be completely off-base here
in
my interpretation of the struts ActionForm though  

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:07 AM
To: [EMAIL PROTECTED]
Subject: date format problems


Hi.

I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
convert it with simpledateformat as dd-MM- and put it in a jsp form.
When submitting the form the date must be coverted back to -MM-DD
before another actions update the db.

I am trying to convert the date value in the ActionForm, but I am
getting the following error.

Any idears? I am lost and it is very urgent

Søren Blidorf


HTTP Status 500 - 




type Exception report

message 

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception 

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.jav
a:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:550)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
5)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641

SV: date format problems

2003-03-07 Thread Søren Blidorf
Yes, it's a good point, but the only place my date is a String, is in
the ActionForm.

Would you store the date as long there?

-Oprindelig meddelelse-
Fra: apachep2 [mailto:[EMAIL PROTECTED] 
Sendt: 7. marts 2003 15:22
Til: 'Struts Users Mailing List'
Emne: RE: date format problems

Never try to store a date as a string. It creates a lot of date format
problems. As I have said, store it as a long so that you can easily do
the conversion.

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED] 
Sent: March 6, 2003 6:42 PM
To: 'Struts Users Mailing List'
Subject: SV: date format problems

Hi.
Thanks for all the answers

I was trying different things because nothing would work for me.

I need one thing:

Convert the String value theForm.GetMyDate() so that I can insert it in
my sql as -MM-dd.

I get the error java.lang.IllegalArgumentException: Cannot format given
Object as a Date

I will look at BeanUtils.copyProperties( beanToCopyTo, beanCopyingFrom
);, but it is probably to complicated for me just now!

What is the best way to fix it?

-Oprindelig meddelelse-
Fra: Chen, Gin [mailto:[EMAIL PROTECTED] 
Sendt: 6. marts 2003 16:31
Til: 'Struts Users Mailing List'
Emne: RE: date format problems

The standard for an actionForm is to have every field as String.
All conversion (which should really be thought of as business logic)
should
occur in the Action classes or further down the food chain. If this is
not
possible in your case or does not solve what your working on then can
you
please give more details?
-Tim


-Original Message-
From: Kandi Potter [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:21 AM
To: Struts Users Mailing List
Subject: RE: date format problems


I'm no expert at struts but I  convert and validate my dates in my
Action or
Business Class instead of the Form.  I could be completely off-base here
in
my interpretation of the struts ActionForm though  

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:07 AM
To: [EMAIL PROTECTED]
Subject: date format problems


Hi.

I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
convert it with simpledateformat as dd-MM- and put it in a jsp form.
When submitting the form the date must be coverted back to -MM-DD
before another actions update the db.

I am trying to convert the date value in the ActionForm, but I am
getting the following error.

Any idears? I am lost and it is very urgent

Søren Blidorf


HTTP Status 500 - 




type Exception report

message 

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception 

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.jav
a:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:550)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
5)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
at
org.apache.catalina.core.StandardPipeline

Re: SV: date format problems

2003-03-07 Thread Rick Reumann
On Fri, 7 Mar 2003 15:26:49 +0100
Søren Blidorf [EMAIL PROTECTED] wrote:

 Yes, it's a good point, but the only place my date is a String, is in
 the ActionForm.
 
 Would you store the date as long there?


With all due respect to apachep2 I would store myDate as a String in an
ActionForm bean and then in your business class you store your Date as
the Date you want (I prefer java.util.Date).

So now the question becomes how do you quickly copy all of your String
form bean properties into this business bean that has a type:
java.util.Date.\

In your action you submit to you do:

BeanUtils.copyProperties( yourBusinessBean, yourActionFormBean )


BUT, as you have realized copyProperties will not work for
java.util.Date. So you need to register a converter.


I posted about this a while a back and a search of the archives reveals
the link below. I would change one thing though... following Craig's
suggestion it's cleaner to register the converter as a Plugin which you
can do easily in your struts-config file. Since all my DispatchAction
classes extend a BaseAction I registered the converter there in a static
block, which works, but it's just cleaner as a Plugin since you could
easily swap out the converter at a later time.

Let me know if this link helps. If you are still having trouble let me
know.

http://marc.theaimsgroup.com/?l=struts-userm=103487187525032w=2


-- 
Rick Reumann

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



date format problems

2003-03-06 Thread Søren Blidorf
Hi.

I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
convert it with simpledateformat as dd-MM- and put it in a jsp form.
When submitting the form the date must be coverted back to -MM-DD
before another actions update the db.

I am trying to convert the date value in the ActionForm, but I am
getting the following error.

Any idears? I am lost and it is very urgent

Søren Blidorf


HTTP Status 500 - 




type Exception report

message 

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception 

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.jav
a:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:550)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
5)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43
2)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:386)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53
4)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:530)
at java.lang.Thread.run(Thread.java:536)


root cause 

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.jav
a:988)
at
org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.jav
a:904)
at
org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932)
at org.apache.struts.util.BeanUtils.populate(BeanUtils.java:509)
at

Re: date format problems

2003-03-06 Thread Gemes Tibor
2003. március 6. 16:06 dátummal Søren Blidorf ezt írtad:
 Hi.

 I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
 convert it with simpledateformat as dd-MM- and put it in a jsp form.
 When submitting the form the date must be coverted back to -MM-DD
 before another actions update the db.

 I am trying to convert the date value in the ActionForm, but I am
 getting the following error.

 Any idears? I am lost and it is very urgent

Register a Converter for your String-Date Date-String conversion
with ConvertUtils. read javadocs
org.apache.commons.beanutils.ConvertUtils

Hth,

Tib

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: date format problems

2003-03-06 Thread Kandi Potter
I'm no expert at struts but I  convert and validate my dates in my Action or Business 
Class instead of the Form.  I could be completely off-base here in my interpretation 
of the struts ActionForm though  

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:07 AM
To: [EMAIL PROTECTED]
Subject: date format problems


Hi.

I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
convert it with simpledateformat as dd-MM- and put it in a jsp form.
When submitting the form the date must be coverted back to -MM-DD
before another actions update the db.

I am trying to convert the date value in the ActionForm, but I am
getting the following error.

Any idears? I am lost and it is very urgent

Søren Blidorf


HTTP Status 500 - 




type Exception report

message 

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception 

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.jav
a:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:550)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
5)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43
2)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:386)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53
4)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:530)
at java.lang.Thread.run(Thread.java:536)


root cause 

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324

RE: date format problems

2003-03-06 Thread Chen, Gin
The standard for an actionForm is to have every field as String.
All conversion (which should really be thought of as business logic) should
occur in the Action classes or further down the food chain. If this is not
possible in your case or does not solve what your working on then can you
please give more details?
-Tim


-Original Message-
From: Kandi Potter [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:21 AM
To: Struts Users Mailing List
Subject: RE: date format problems


I'm no expert at struts but I  convert and validate my dates in my Action or
Business Class instead of the Form.  I could be completely off-base here in
my interpretation of the struts ActionForm though  

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:07 AM
To: [EMAIL PROTECTED]
Subject: date format problems


Hi.

I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
convert it with simpledateformat as dd-MM- and put it in a jsp form.
When submitting the form the date must be coverted back to -MM-DD
before another actions update the db.

I am trying to convert the date value in the ActionForm, but I am
getting the following error.

Any idears? I am lost and it is very urgent

Søren Blidorf


HTTP Status 500 - 




type Exception report

message 

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception 

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.jav
a:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:550)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
5)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43
2)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:386)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53
4)
at
org.apache.tomcat.util.threads.ThreadPool

RE: date format problems

2003-03-06 Thread apachep2
Make sure it is a java.sql.Date during conversion using ConvertUtil.

-Original Message-
From: Gemes Tibor [mailto:[EMAIL PROTECTED] 
Sent: March 6, 2003 10:14 AM
To: Struts Users Mailing List
Subject: Re: date format problems

2003. március 6. 16:06 dátummal Søren Blidorf ezt írtad:
 Hi.

 I have an action that gets a date from the MS SQL 2000 in -MM-dd.
I
 convert it with simpledateformat as dd-MM- and put it in a jsp
form.
 When submitting the form the date must be coverted back to -MM-DD
 before another actions update the db.

 I am trying to convert the date value in the ActionForm, but I am
 getting the following error.

 Any idears? I am lost and it is very urgent

Register a Converter for your String-Date Date-String conversion
with ConvertUtils. read javadocs
org.apache.commons.beanutils.ConvertUtils

Hth,

Tib

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: date format problems

2003-03-06 Thread apachep2
You are not alone.

Re the original posting, I have another thought.

1. Date can be displayed using format string.
2. Date can be saved as long.

Will that reduce your conversion?

-Original Message-
From: Kandi Potter [mailto:[EMAIL PROTECTED] 
Sent: March 6, 2003 10:21 AM
To: Struts Users Mailing List
Subject: RE: date format problems

I'm no expert at struts but I  convert and validate my dates in my
Action or Business Class instead of the Form.  I could be completely
off-base here in my interpretation of the struts ActionForm
though  

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:07 AM
To: [EMAIL PROTECTED]
Subject: date format problems


Hi.

I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
convert it with simpledateformat as dd-MM- and put it in a jsp form.
When submitting the form the date must be coverted back to -MM-DD
before another actions update the db.

I am trying to convert the date value in the ActionForm, but I am
getting the following error.

Any idears? I am lost and it is very urgent

Søren Blidorf


HTTP Status 500 - 




type Exception report

message 

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception 

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.jav
a:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:550)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
5)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43
2)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:386)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53
4)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:530)
at java.lang.Thread.run(Thread.java:536)


root cause 

java.lang.reflect.InvocationTargetException

Re: date format problems

2003-03-06 Thread Rick Reumann
On Thu, 6 Mar 2003 16:14:26 +0100
Gemes Tibor [EMAIL PROTECTED] wrote:

 2003. március 6. 16:06 dátummal Søren Blidorf ezt írtad:
  Hi.
 
  I have an action that gets a date from the MS SQL 2000 in
  -MM-dd. I convert it with simpledateformat as dd-MM- and put
  it in a jsp form. When submitting the form the date must be coverted
  back to -MM-DD before another actions update the db.
 
  I am trying to convert the date value in the ActionForm, but I am
  getting the following error.
 
  Any idears? I am lost and it is very urgent
 
 Register a Converter for your String-Date Date-String conversion
 with ConvertUtils. read javadocs
 org.apache.commons.beanutils.ConvertUtils

Actually check the archives on BeanUtils coverting java.util.Date. I
posted the converter you need to register in order to do the
conversion. If you can't find it in the archives let me know and I'll
look for it.



-- 
Rick Reumann

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: date format problems

2003-03-06 Thread Rick Reumann
On Thu, 6 Mar 2003 10:39:08 -0500
apachep2 [EMAIL PROTECTED] wrote:

 You are not alone.
 
 Re the original posting, I have another thought.
 
 1. Date can be displayed using format string.
 2. Date can be saved as long.
 
 Will that reduce your conversion?

I think he wants to use BeanUtils.copyProperties() though which will do
the conversion for him. The approach you guys (I think) are taking
involves doing the actual conversion up front. If you register a
converter to BeanUtils, you can easily copy all the FormBean fields to a
DataTransferObject (or ValueObject, or whatever you want to call it:) in
one fell swoop:

BeanUtils.copyProperties( beanToCopyTo, beanCopyingFrom );

Normally you don't even need to register a converter, but, unless things
have changed recently, copyProperties() will not work by default on
java.util.Date property.


-- 
Rick Reumann

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



SV: date format problems

2003-03-06 Thread Søren Blidorf
Hi.
Thanks for all the answers

I was trying different things because nothing would work for me.

I need one thing:

Convert the String value theForm.GetMyDate() so that I can insert it in
my sql as -MM-dd.

I get the error java.lang.IllegalArgumentException: Cannot format given
Object as a Date

I will look at BeanUtils.copyProperties( beanToCopyTo, beanCopyingFrom
);, but it is probably to complicated for me just now!

What is the best way to fix it?

-Oprindelig meddelelse-
Fra: Chen, Gin [mailto:[EMAIL PROTECTED] 
Sendt: 6. marts 2003 16:31
Til: 'Struts Users Mailing List'
Emne: RE: date format problems

The standard for an actionForm is to have every field as String.
All conversion (which should really be thought of as business logic)
should
occur in the Action classes or further down the food chain. If this is
not
possible in your case or does not solve what your working on then can
you
please give more details?
-Tim


-Original Message-
From: Kandi Potter [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:21 AM
To: Struts Users Mailing List
Subject: RE: date format problems


I'm no expert at struts but I  convert and validate my dates in my
Action or
Business Class instead of the Form.  I could be completely off-base here
in
my interpretation of the struts ActionForm though  

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:07 AM
To: [EMAIL PROTECTED]
Subject: date format problems


Hi.

I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
convert it with simpledateformat as dd-MM- and put it in a jsp form.
When submitting the form the date must be coverted back to -MM-DD
before another actions update the db.

I am trying to convert the date value in the ActionForm, but I am
getting the following error.

Any idears? I am lost and it is very urgent

Søren Blidorf


HTTP Status 500 - 




type Exception report

message 

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception 

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.jav
a:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:550)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
5)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext

RE: date format problems

2003-03-06 Thread Michael Cardon
Here is what I do. The client enters a date of birth date as a string on the
form, then I convert it to a java.sql.Date object in this method.


/**
 * Sets the dobStr
 * @param dobStr The dobStr to set
 */
public void setDobStr(String dobStr) throws java.text.ParseException {
this.dobStr = dobStr;

// reset the Date object
this.dobDate = null;

if ((dobStr != null)  (dobStr.length()  0)) {
SimpleDateFormat sdf = new SimpleDateFormat(MM/dd/yy);
sdf.setLenient(false);

try {
java.util.Date dt = sdf.parse(dobStr);
this.dobDate = new java.sql.Date(dt.getTime());

} catch (ParseException pe) {
throw new java.text.ParseException(Date Of Birth:,
pe.getErrorOffset());
}
}
}

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 3:42 PM
To: 'Struts Users Mailing List'
Subject: SV: date format problems


Hi.
Thanks for all the answers

I was trying different things because nothing would work for me.

I need one thing:

Convert the String value theForm.GetMyDate() so that I can insert it in
my sql as -MM-dd.

I get the error java.lang.IllegalArgumentException: Cannot format given
Object as a Date

I will look at BeanUtils.copyProperties( beanToCopyTo, beanCopyingFrom
);, but it is probably to complicated for me just now!

What is the best way to fix it?

-Oprindelig meddelelse-
Fra: Chen, Gin [mailto:[EMAIL PROTECTED]
Sendt: 6. marts 2003 16:31
Til: 'Struts Users Mailing List'
Emne: RE: date format problems

The standard for an actionForm is to have every field as String.
All conversion (which should really be thought of as business logic)
should
occur in the Action classes or further down the food chain. If this is
not
possible in your case or does not solve what your working on then can
you
please give more details?
-Tim


-Original Message-
From: Kandi Potter [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:21 AM
To: Struts Users Mailing List
Subject: RE: date format problems


I'm no expert at struts but I  convert and validate my dates in my
Action or
Business Class instead of the Form.  I could be completely off-base here
in
my interpretation of the struts ActionForm though

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:07 AM
To: [EMAIL PROTECTED]
Subject: date format problems


Hi.

I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
convert it with simpledateformat as dd-MM- and put it in a jsp form.
When submitting the form the date must be coverted back to -MM-DD
before another actions update the db.

I am trying to convert the date value in the ActionForm, but I am
getting the following error.

Any idears? I am lost and it is very urgent

Søren Blidorf


HTTP Status 500 -




type Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.jav
a:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:550)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke

SV: date format problems

2003-03-06 Thread Søren Blidorf
That did it, Thanks a million.

It looks almost like what I did, but I found my mistake.

-Oprindelig meddelelse-
Fra: Michael Cardon [mailto:[EMAIL PROTECTED] 
Sendt: 7. marts 2003 00:50
Til: Struts Users Mailing List
Emne: RE: date format problems

Here is what I do. The client enters a date of birth date as a string on
the
form, then I convert it to a java.sql.Date object in this method.


/**
 * Sets the dobStr
 * @param dobStr The dobStr to set
 */
public void setDobStr(String dobStr) throws
java.text.ParseException {
this.dobStr = dobStr;

// reset the Date object
this.dobDate = null;

if ((dobStr != null)  (dobStr.length()  0)) {
SimpleDateFormat sdf = new
SimpleDateFormat(MM/dd/yy);
sdf.setLenient(false);

try {
java.util.Date dt = sdf.parse(dobStr);
this.dobDate = new
java.sql.Date(dt.getTime());

} catch (ParseException pe) {
throw new java.text.ParseException(Date
Of Birth:,
pe.getErrorOffset());
}
}
}

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 3:42 PM
To: 'Struts Users Mailing List'
Subject: SV: date format problems


Hi.
Thanks for all the answers

I was trying different things because nothing would work for me.

I need one thing:

Convert the String value theForm.GetMyDate() so that I can insert it in
my sql as -MM-dd.

I get the error java.lang.IllegalArgumentException: Cannot format given
Object as a Date

I will look at BeanUtils.copyProperties( beanToCopyTo, beanCopyingFrom
);, but it is probably to complicated for me just now!

What is the best way to fix it?

-Oprindelig meddelelse-
Fra: Chen, Gin [mailto:[EMAIL PROTECTED]
Sendt: 6. marts 2003 16:31
Til: 'Struts Users Mailing List'
Emne: RE: date format problems

The standard for an actionForm is to have every field as String.
All conversion (which should really be thought of as business logic)
should
occur in the Action classes or further down the food chain. If this is
not
possible in your case or does not solve what your working on then can
you
please give more details?
-Tim


-Original Message-
From: Kandi Potter [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:21 AM
To: Struts Users Mailing List
Subject: RE: date format problems


I'm no expert at struts but I  convert and validate my dates in my
Action or
Business Class instead of the Form.  I could be completely off-base here
in
my interpretation of the struts ActionForm though

-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 10:07 AM
To: [EMAIL PROTECTED]
Subject: date format problems


Hi.

I have an action that gets a date from the MS SQL 2000 in -MM-dd. I
convert it with simpledateformat as dd-MM- and put it in a jsp form.
When submitting the form the date must be coverted back to -MM-DD
before another actions update the db.

I am trying to convert the date value in the ActionForm, but I am
getting the following error.

Any idears? I am lost and it is very urgent

Søren Blidorf


HTTP Status 500 -




type Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.jav
a:2061)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643

Re: date format problems

2003-03-06 Thread Gemes Tibor
For an example in a static block of your BaseAction class.

Tib 

2003. március 7. 00:05 dátummal Marco Tedone ezt írtad:
 How do you register a converter with ConvertUtils in Struts? I gave a look
 to the commons-beanutils package but I couldn't figure how to use the
 contract specified by these classes with Struts. Is there a way to register
 an automatic converter for all data sent back and forward from the browser?

 Marco

  -Original Message-
  From: Gemes Tibor [mailto:[EMAIL PROTECTED]
  Sent: Thursday, March 06, 2003 3:14 PM
  To: Struts Users Mailing List
  Subject: Re: date format problems
 
  2003. március 6. 16:06 dátummal Søren Blidorf ezt írtad:
   Hi.
  
   I have an action that gets a date from the MS SQL 2000 in
 
  -MM-dd.
 
   I convert it with simpledateformat as dd-MM- and put it
 
  in a jsp
 
   form. When submitting the form the date must be coverted back to
   -MM-DD before another actions update the db.
  
   I am trying to convert the date value in the ActionForm, but I am
   getting the following error.
  
   Any idears? I am lost and it is very urgent
 
  Register a Converter for your String-Date Date-String
  conversion with ConvertUtils. read javadocs
  org.apache.commons.beanutils.ConvertUtils
 
  Hth,
 
  Tib


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



date format

2003-02-17 Thread usha
Hi

i need to display the date fields on the jsp in the format dd/MMM/. 
is there any simple way i can get this like configuration or writing any 
class etc.. if anybody has any ideas plz help me

Thanks
usha


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: date format

2003-02-17 Thread Desmond
Use the SimpleDateFormat to do it so. Refer this webpage
http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html

-Original Message-
From: usha [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 17, 2003 3:38 AM
To: [EMAIL PROTECTED]
Subject: date format


Hi

i need to display the date fields on the jsp in the format dd/MMM/.
is there any simple way i can get this like configuration or writing any
class etc.. if anybody has any ideas plz help me

Thanks
usha


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: date format

2003-02-17 Thread Mark Chaimungkalanont

Going for a neat solution, in our project, we tried extending sql.Date
and overwriting the toString method to output a date formatted with
SimpleDateFormat in dd/MM/ format, We then used this data type as our
Date type in our data beans so that when you do a bean:write on it, it will
output the date in the correct format

Unfortunately, we were using scaffold StorageBaseBean findCollection to get
our data and for some reason or another, it was having some casting issues.

We had to resort to creating xxxString version of the dates in the data
bean that converts the dats into their correct format before returning the
string

cheers

MC


   

  Desmond

  [EMAIL PROTECTED]To:   Struts Users Mailing List 
[EMAIL PROTECTED]  
  t   cc: 

   Subject:  RE: date format   

  19/02/2003 04:03 

  AM   

  Please respond to

  Struts Users

  Mailing List

   

   




Use the SimpleDateFormat to do it so. Refer this webpage
http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html

-Original Message-
From: usha [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 17, 2003 3:38 AM
To: [EMAIL PROTECTED]
Subject: date format


Hi

i need to display the date fields on the jsp in the format dd/MMM/.
is there any simple way i can get this like configuration or writing any
class etc.. if anybody has any ideas plz help me

Thanks
usha


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Date format question

2003-02-05 Thread Swish

Hello,

I was wondering if there is a way to use the bean:write  tag to convert a string in 
sql time stamp format to a format of my choosing. I believe one can write a Date 
object out using bean:write ...format=dd/MM//, but can I convert a string 
2002-12-25 00:00:00 to 12/25/2002.  Thanks in advance for your suggestions!!!



-
Post your free ad now! Yahoo! Canada Personals



RE: Date format question

2003-02-05 Thread John Espey
the JSTL format parseDate tag will do the trick for you

-Original Message-
From: Swish [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 05, 2003 7:34 PM
To: Struts Users Mailing List
Subject: Date format question



Hello,

I was wondering if there is a way to use the bean:write  tag to convert a
string in sql time stamp format to a format of my choosing. I believe one
can write a Date object out using bean:write ...format=dd/MM//, but
can I convert a string 2002-12-25 00:00:00 to 12/25/2002.  Thanks in
advance for your suggestions!!!



-
Post your free ad now! Yahoo! Canada Personals


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Date format question

2003-02-05 Thread Garth Patil
if you are not using the jstl tags, you can also put a convenience method in 
your bean that looks something like this. refer to the java.text.DateFormat 
javadoc for how to format based on the parameters you pass to 
getDateTimeInstance.

public String getDateFormatted() {
  DateFormat df = 
DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.SHORT);
  return df.format(getDate());
}



From: John Espey [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: RE: Date format question
Date: Wed, 5 Feb 2003 19:36:23 -0600

the JSTL format parseDate tag will do the trick for you

-Original Message-
From: Swish [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 05, 2003 7:34 PM
To: Struts Users Mailing List
Subject: Date format question



Hello,

I was wondering if there is a way to use the bean:write  tag to convert a
string in sql time stamp format to a format of my choosing. I believe one
can write a Date object out using bean:write ...format=dd/MM//, but
can I convert a string 2002-12-25 00:00:00 to 12/25/2002.  Thanks in
advance for your suggestions!!!



-
Post your free ad now! Yahoo! Canada Personals


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



New BeanUtil 1.6/ConvertUtils/Date Format/toString()

2003-01-23 Thread Jim Krygowski
Hi All-

A little while ago someone on this list emailed me directly with a question
and I didn't have the answer he wanted.  In the intervening days, I lost
this person's email, so I'm going to post to the list hoping that he will
get this message.

You asked me how one could use Rick Reumann approach of registering date
converters to convert java.util.Date when rendering a JSP page.  You were
under the same impression as I initially was: i.e. The two converters would
work automatically to convert the Date to and from a String when rendering
the HTML and reading from the Request.

Examining the code and corresponding with Rick led me to understand that
Rick's approach requires 2 beans, one that is type-safe the other having
only String members.  The String bean (no pun intended) is used in the JSP
to render the page.  The type-safe bean is used by the model when executing
business logic.  The Action copies between these two beans during the
transitions (getting info from the JSP, sending info to the JSP for
rendering).

Of course this means that you have to explicitly code for this in your
Action.  And it means that if you're rendering complex ValueObject graphs on
your JSP, you have to create a parallel  set of String bean type value
objects to use when rendering the JSP.  This could be a lot of extra work
initially and going forward during maintenance of the application.

I thought it would be better if ConvertUtils was smart enough to recognize
that getting a String value for an Object might involve more than just
calling toString().  Well, as of BeanUtils 1.6, ConvertUtils does recognize
converters when getting String values for objects.  So, now it seems that
Rick's two converters can now be used without an explicit conversion step
coded in your Actions.  You should be able to set it up just like Rick
explains in his posts to this mailing list and you'll see the dates
formatted correctly on your JSP when you render it.

Many thanks to whoever (Craig R. McClanahan || Ralph Schaer || Chris Audley)
made the change to ConvertUtils.

jk


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: [OT] Date format

2003-01-17 Thread Andrew Hill
Your best bet is to use the static factory methods in the DateFormat class.

ie:
Locale locale = getLocale(request); //Use struts Action method to get locale

dateTimeFormat =
ateFormat.getDateTimeInstance( DateFormat.SHORT,DateFormat.SHORT, locale);
dateFormat = DateFormat.getDateInstance( DateFormat.SHORT, locale);
timeFormat = DateFormat.getTimeInstance( DateFormat.SHORT, locale);

Its all in the javadocs you know. :-)

btw
In case you were wondering how the java.util.Date.toString() works, heres
its source code:

public String toString() {
DateFormat formatter = null;
if (simpleFormatter != null) {
formatter = (DateFormat)simpleFormatter.get();
}
if (formatter == null) {
/* No cache yet, or cached formatter GC'd */
formatter = new SimpleDateFormat(EEE MMM dd HH:mm:ss zzz ,
 Locale.US);
simpleFormatter = new SoftReference(formatter);
}
synchronized (formatter) {
formatter.setTimeZone(TimeZone.getDefault());
return formatter.format(this);
}
}
/btw

-Original Message-
From: Suresh Addagalla [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 16 January 2003 22:56
To: [EMAIL PROTECTED]
Subject: Date format


Hi,

Please excuse me for the off-topic question, I need this urgently, so
posting it.

How can I get the current date format? (style: DateFormat.SHORT, locale:
Default)

I used:

SimpleDateFormat formatter = new SimpleDateFormat() ;
String format = formatter.toPattern() ;

It gives:

M/d/yy hh:mm a

But what I want is *only* the date part, excluding the time part of it.

Thanks,
Suresh



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: [OT] Date format

2003-01-17 Thread Suresh Addagalla
Hi,

What I am looking for is how to display the *format*, and not how to
display a date in a given format. So, there doesn't seem to be anything
provided with the API.

I need a method like toPattern() of SimpleDateFormat in the DateFormat
class because getDateInstance() returns me DateFormat and not
SimpleDateFormat.

Suresh

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 17, 2003 9:11 AM
To: Struts Users Mailing List
Subject: RE: [OT] Date format


Your best bet is to use the static factory methods in the 
DateFormat class.

ie:
Locale locale = getLocale(request); //Use struts Action method 
to get locale

dateTimeFormat =
ateFormat.getDateTimeInstance( 
DateFormat.SHORT,DateFormat.SHORT, locale);
dateFormat = DateFormat.getDateInstance( DateFormat.SHORT, locale);
timeFormat = DateFormat.getTimeInstance( DateFormat.SHORT, locale);

Its all in the javadocs you know. :-)

btw
In case you were wondering how the java.util.Date.toString() 
works, heres
its source code:

public String toString() {
   DateFormat formatter = null;
   if (simpleFormatter != null) {
   formatter = (DateFormat)simpleFormatter.get();
   }
   if (formatter == null) {
   /* No cache yet, or cached formatter GC'd */
   formatter = new SimpleDateFormat(EEE MMM dd 
HH:mm:ss zzz ,
Locale.US);
   simpleFormatter = new SoftReference(formatter);
   }
synchronized (formatter) {
formatter.setTimeZone(TimeZone.getDefault());
return formatter.format(this);
}
}
/btw

-Original Message-
From: Suresh Addagalla [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 16 January 2003 22:56
To: [EMAIL PROTECTED]
Subject: Date format


Hi,

Please excuse me for the off-topic question, I need this urgently, so
posting it.

How can I get the current date format? (style: 
DateFormat.SHORT, locale:
Default)

I used:

SimpleDateFormat formatter = new SimpleDateFormat() ;
String format = formatter.toPattern() ;

It gives:

M/d/yy hh:mm a

But what I want is *only* the date part, excluding the time part of it.

Thanks,
Suresh


**Disclaimer** 
   
 
 Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' 
and 'confidential' and intended for use only by the individual or entity to which it 
is 
addressed. You are notified that any use, copying or dissemination of the information 
contained in the E-MAIL in any manner whatsoever is strictly prohibited.







--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


RE: [OT] Date format

2003-01-17 Thread Andrew Hill
Ok. This is wierd. I posted this in the morning - now its 11pm and it only
just arrived. Maybe I should have used snail mail!

Ah of course - its Friday. Guess the email server is taking it easy... ;-)

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]]
Sent: Friday, 17 January 2003 11:41
To: Struts Users Mailing List
Subject: RE: [OT] Date format


Your best bet is to use the static factory methods in the DateFormat class.

ie:
Locale locale = getLocale(request); //Use struts Action method to get locale

dateTimeFormat =
ateFormat.getDateTimeInstance( DateFormat.SHORT,DateFormat.SHORT, locale);
dateFormat = DateFormat.getDateInstance( DateFormat.SHORT, locale);
timeFormat = DateFormat.getTimeInstance( DateFormat.SHORT, locale);

Its all in the javadocs you know. :-)

btw
In case you were wondering how the java.util.Date.toString() works, heres
its source code:

public String toString() {
DateFormat formatter = null;
if (simpleFormatter != null) {
formatter = (DateFormat)simpleFormatter.get();
}
if (formatter == null) {
/* No cache yet, or cached formatter GC'd */
formatter = new SimpleDateFormat(EEE MMM dd HH:mm:ss zzz ,
 Locale.US);
simpleFormatter = new SoftReference(formatter);
}
synchronized (formatter) {
formatter.setTimeZone(TimeZone.getDefault());
return formatter.format(this);
}
}
/btw

-Original Message-
From: Suresh Addagalla [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 16 January 2003 22:56
To: [EMAIL PROTECTED]
Subject: Date format


Hi,

Please excuse me for the off-topic question, I need this urgently, so
posting it.

How can I get the current date format? (style: DateFormat.SHORT, locale:
Default)

I used:

SimpleDateFormat formatter = new SimpleDateFormat() ;
String format = formatter.toPattern() ;

It gives:

M/d/yy hh:mm a

But what I want is *only* the date part, excluding the time part of it.

Thanks,
Suresh



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: [OT] Date format

2003-01-17 Thread Andrew Hill
DateFormat is an abstract class of which SimpleDateFormat is a subclass.

When you call getDateInstance() what you get back is actually a
SimpleDateFormat - however I am under the distinct impression this depends
on the locale. Some locales could in theory give back something different
again or if the implementation of the factory methods changes in a future
JVM maybe it wouldnt use SimpleDateFormat?

You could do an instanceof to check if its a SimpleDateFormat and proceed
from there - of course for those locales that dont use SimpleDateFormat then
AFAIK you wont be able to get the pattern - this is because pattern is a
SimpleDateFormat feature and not a DateFormat thing so if it isnt a
SimpleDateFormat (or subclass of SimpleDateFormat) then there isnt a pattern
you can make use of anyway! (I could be wrong on that)

Out of curiosity I tried the following:
Locale[] locales = Locale.getAvailableLocales();
System.out.println(numLocales= + locales.length);
for(int i=0; i  locales.length; i++)
{
  Locale locale = locales[i];
  DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, locale);
  String klass = df.getClass().getName();
  if(!(java.text.SimpleDateFormat.equals(klass)))
  {
System.out.println(class for locale + locale +  is  +
df.getClass().getName() );
  }
}

It reported 145 available locales on my JVM. ALL of them used
SimpleDateFormat.
(But you cant rely on that - and in general its not considered good practice
to make assumptions about which implementation class you get back for a
factory method that returns a superclass or interface...)

Sorry I cant be of more help :-(

-Original Message-
From: Suresh Addagalla [mailto:[EMAIL PROTECTED]]
Sent: Friday, 17 January 2003 22:42
To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
Subject: RE: [OT] Date format


Hi,

What I am looking for is how to display the *format*, and not how to
display a date in a given format. So, there doesn't seem to be anything
provided with the API.

I need a method like toPattern() of SimpleDateFormat in the DateFormat
class because getDateInstance() returns me DateFormat and not
SimpleDateFormat.

Suresh

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 17, 2003 9:11 AM
To: Struts Users Mailing List
Subject: RE: [OT] Date format


Your best bet is to use the static factory methods in the
DateFormat class.

ie:
Locale locale = getLocale(request); //Use struts Action method
to get locale

dateTimeFormat =
ateFormat.getDateTimeInstance( 
DateFormat.SHORT,DateFormat.SHORT, locale);
dateFormat = DateFormat.getDateInstance( DateFormat.SHORT, locale);
timeFormat = DateFormat.getTimeInstance( DateFormat.SHORT, locale);

Its all in the javadocs you know. :-)

btw
In case you were wondering how the java.util.Date.toString() 
works, heres
its source code:

public String toString() {
   DateFormat formatter = null;
   if (simpleFormatter != null) {
   formatter = (DateFormat)simpleFormatter.get();
   }
   if (formatter == null) {
   /* No cache yet, or cached formatter GC'd */
   formatter = new SimpleDateFormat(EEE MMM dd 
HH:mm:ss zzz ,
Locale.US);
   simpleFormatter = new SoftReference(formatter);
   }
synchronized (formatter) {
formatter.setTimeZone(TimeZone.getDefault());
return formatter.format(this);
}
}
/btw

-Original Message-
From: Suresh Addagalla [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 16 January 2003 22:56
To: [EMAIL PROTECTED]
Subject: Date format


Hi,

Please excuse me for the off-topic question, I need this urgently, so
posting it.

How can I get the current date format? (style: 
DateFormat.SHORT, locale:
Default)

I used:

SimpleDateFormat formatter = new SimpleDateFormat() ;
String format = formatter.toPatte
rn() ;

It gives:

M/d/yy hh:mm a

But what I want is *only* the date part, excluding the time part of it.

Thanks,
Suresh



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: [OT] Date format

2003-01-17 Thread Mark Lepkowski
RE: [OT] Date formatWith SimpleDateFormat you specify the format as a String.  You 
surely should be able to display that string.
  What I am looking for is how to display the *format*, and not how to 
  display a date in a given format. (snip)




Date format

2003-01-16 Thread Suresh Addagalla
Hi,

Please excuse me for the off-topic question, I need this urgently, so
posting it.

How can I get the current date format? (style: DateFormat.SHORT, locale:
Default)

I used:

SimpleDateFormat formatter = new SimpleDateFormat() ;
String format = formatter.toPattern() ;

It gives:

M/d/yy hh:mm a

But what I want is *only* the date part, excluding the time part of it.

Thanks,
Suresh


**Disclaimer** 
   
 
 Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' 
and 'confidential' and intended for use only by the individual or entity to which it 
is 
addressed. You are notified that any use, copying or dissemination of the information 
contained in the E-MAIL in any manner whatsoever is strictly prohibited.







--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


Re: Date format

2003-01-16 Thread Mark Lepkowski
Date formatString myDate = new SimpleDateFormat(dd MMM ).format( new 
java.util.Date() );

comp.lang.java.programmer is a good news group for java language related questions.
  - Original Message - 
  From: Suresh Addagalla 
  To: [EMAIL PROTECTED] 
  Sent: Thursday, January 16, 2003 9:55 AM
  Subject: Date format


  Hi, 

  Please excuse me for the off-topic question, I need this urgently, so 
  posting it. 

  How can I get the current date format? (style: DateFormat.SHORT, locale: 
  Default) 

  I used: 

  SimpleDateFormat formatter = new SimpleDateFormat() ; 
  String format = formatter.toPattern() ; 

  It gives: 

  M/d/yy hh:mm a 

  But what I want is *only* the date part, excluding the time part of it. 

  Thanks, 
  Suresh 

   




RE: Date format

2003-01-16 Thread Mark Galbreath
Check out java.util.Calendar.  Particularly the constants.

Mark

-Original Message-
From: Suresh Addagalla [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 16, 2003 9:56 AM

How can I get the current date format? (style: DateFormat.SHORT, locale:
Default)



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




date format

2002-12-18 Thread Doug Ogateter

Hi:
I have a problem with date format. I appreciate your help.
Using bean:write name=customer property=day /, the web page displayed the day as 
Sun Nov 30 00:00:00 EST 1980  . To format the day, I added formatKey, so the above tag 
bean:write tag becomes bean:write name=customer property=day  
formatKey=customer.day.format/. In my ApplicationResources.properties, I have 
customer.day.format=dd/mm/. The problem is, after I used the formatKey, it shows 
me 30/00/1980(the month part becomes 00. It should show me 30/11/1980). 
I am using struts1.1. Could anyone help me out? Is it the formatKey problem? Thank you 
very much.

Regards,

Doug



-
Post your free ad now! Yahoo! Canada Personals



RE: date format

2002-12-18 Thread James Childers
Try 

customer.day.format=dd/MM/

mm = minutes in hour
MM = months

-= J

 -Original Message-
 From: Doug Ogateter [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 18, 2002 9:52 AM
 To: Struts Users Mailing List
 Subject: date format
 
 
 
 Hi:
 I have a problem with date format. I appreciate your help.
 Using bean:write name=customer property=day /, the web 
 page displayed the day as Sun Nov 30 00:00:00 EST 1980  . To 
 format the day, I added formatKey, so the above tag 
 bean:write tag becomes bean:write name=customer 
 property=day  formatKey=customer.day.format/. In my 
 ApplicationResources.properties, I have 
 customer.day.format=dd/mm/. The problem is, after I used 
 the formatKey, it shows me 30/00/1980(the month part becomes 
 00. It should show me 30/11/1980). 
 I am using struts1.1. Could anyone help me out? Is it the 
 formatKey problem? Thank you very much.
 
 Regards,
 
 Doug
 
 
 
 -
 Post your free ad now! Yahoo! Canada Personals
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: date format

2002-12-18 Thread Doug Ogateter

James:
It WORKS! IT'S AMAZING!
THANK YOU VERY MUCH!
BEST REGARDS,
Doug
 James Childers [EMAIL PROTECTED] wrote:Try 

customer.day.format=dd/MM/

mm = minutes in hour
MM = months

-= J

 -Original Message-
 From: Doug Ogateter [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 18, 2002 9:52 AM
 To: Struts Users Mailing List
 Subject: date format
 
 
 
 Hi:
 I have a problem with date format. I appreciate your help.
 Using , the web 
 page displayed the day as Sun Nov 30 00:00:00 EST 1980 . To 
 format the day, I added formatKey, so the above tag 
 bean:write tag becomes  property=day formatKey=customer.day.format/. In my 
 ApplicationResources.properties, I have 
 customer.day.format=dd/mm/. The problem is, after I used 
 the formatKey, it shows me 30/00/1980(the month part becomes 
 00. It should show me 30/11/1980). 
 I am using struts1.1. Could anyone help me out? Is it the 
 formatKey problem? Thank you very much.
 
 Regards,
 
 Doug
 
 
 
 -
 Post your free ad now! Yahoo! Canada Personals
 

--
To unsubscribe, e-mail: 
For additional commands, e-mail: 



-
Post your free ad now! Yahoo! Canada Personals



bean:write and Date format

2002-09-23 Thread Cathy Osekizoglu


Using bean:write name=aPayment property=date/, I got the date as: Fri Aug 24   
23:42:00   EDT   2002.

How can I change it to  Fri Aug 24 02  23:42  using struts tag?

Thank you for your help.

Cathy



-
Post your free ad now! Yahoo! Canada Personals



Re: bean:write and Date format

2002-09-23 Thread Jeff_Mychasiw


If you are using Struts 1.1 then you can use the formatKey attribute of the
tag

formatKey=format.date.long

with a key in you properties file as such: format.date.long=  d, 
** I think this only works if you are putting Date or Timestamp to the page.


If not 1.1 then I guess you could a helper method is the form bean that formats the 
date called
String getDateFormatted() ..





Cathy Osekizoglu [EMAIL PROTECTED] on 09/23/2002 03:17:42 PM

Please respond to Struts Users Mailing List
   [EMAIL PROTECTED]

To:[EMAIL PROTECTED]
cc:

Subject:bean:write and Date format



Using bean:write name=aPayment property=date/, I got the date as:
Fri Aug 24   23:42:00   EDT   2002.

How can I change it to  Fri Aug 24 02  23:42  using struts tag?

Thank you for your help.

Cathy



-
Post your free ad now! Yahoo! Canada Personals








--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: bean:write and Date format

2002-09-23 Thread Cathy Osekizoglu


 Jeff:
I am using struts1.1. I tried use formatKey as you discribed, but the whole page 
becomes balnk. So I guess I need to put Date or Timestamp to my page. 
How can I put date ot Timestamp in my page. Sorry for the simple question. I am new to 
java and jsp.
 
Thanks
  [EMAIL PROTECTED] wrote: 
If you are using Struts 1.1 then you can use the formatKey attribute of the
tag

formatKey=format.date.long

with a key in you properties file as such: format.date.long=  d, 
** I think this only works if you are putting Date or Timestamp to the page.


If not 1.1 then I guess you could a helper method is the form bean that formats the 
date called
String getDateFormatted() ..





Cathy Osekizoglu on 09/23/2002 03:17:42 PM

Please respond to Struts Users Mailing List


To: [EMAIL PROTECTED]
cc:

Subject: bean:write and Date format



Using , I got the date as:
Fri Aug 24 23:42:00 EDT 2002.

How can I change it to  Fri Aug 24 02 23:42  using struts tag?

Thank you for your help.

Cathy



-
Post your free ad now! Yahoo! Canada Personals








--
To unsubscribe, e-mail: 
For additional commands, e-mail: 



-
Post your free ad now! Yahoo! Canada Personals



Re: bean:write and Date format

2002-09-23 Thread Jeff_Mychasiw


If yor page is blank it is usually because an exception has been thrown.
Check your server log.

In our case our value objects have Date or Timestamp.  Often we will also
put the value object in the form bean and put the value out when
using the bean:write tag:
bean:write name=myForm property=myValueObject.myDate  formatKey
=key/

Also instead of the formatKey, you could also use the format property and
just put the format mask directly into the tag.
format=  d,  . When you find the right combination, change it
to the formatKey.
(you don't have to keep restarting the app).






Cathy Osekizoglu [EMAIL PROTECTED] on 09/23/2002 04:05:09 PM

Please respond to Struts Users Mailing List
   [EMAIL PROTECTED]

To:Struts Users Mailing List [EMAIL PROTECTED]
cc:

Subject:Re: bean:write and Date format



 Jeff:
I am using struts1.1. I tried use formatKey as you discribed, but the whole
page becomes balnk. So I guess I need to put Date or Timestamp to my
page.
How can I put date ot Timestamp in my page. Sorry for the simple question.
I am new to java and jsp.

Thanks
  [EMAIL PROTECTED] wrote:
If you are using Struts 1.1 then you can use the formatKey attribute of the
tag

formatKey=format.date.long

with a key in you properties file as such: format.date.long=  d,

** I think this only works if you are putting Date or Timestamp to the
page.


If not 1.1 then I guess you could a helper method is the form bean that
formats the date called
String getDateFormatted() ..





Cathy Osekizoglu on 09/23/2002 03:17:42 PM

Please respond to Struts Users Mailing List


To: [EMAIL PROTECTED]
cc:

Subject: bean:write and Date format



Using , I got the date as:
Fri Aug 24 23:42:00 EDT 2002.

How can I change it to  Fri Aug 24 02 23:42  using struts tag?

Thank you for your help.

Cathy



-
Post your free ad now! Yahoo! Canada Personals








--
To unsubscribe, e-mail:
For additional commands, e-mail:



-
Post your free ad now! Yahoo! Canada Personals








--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]