RE: ActionForm data type X BeanUtils - using Dates

2004-09-08 Thread Desai, Sunny
BeanUtils.copyProperties() method does not work with date fields.

One needs to copy it manually using DateFormatter ot something. To avoid
garbage getting into date variable in domain object, one should name it
other way.

For example, if domain object has : Date paymentDate; you should rename the
variable for this date in form as datePayment so that it does not get copied
to domain object. 

-Original Message-
From: Leandro Melo [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 08, 2004 10:21 AM
To: struts jakarta
Subject: ActionForm data type X BeanUtils - using Dates


Hi,
i believe that a lot of developers use BeanUtils to
copy the data from ActionForms to the specific DTOs.
I've used this approach, but right now i'm facing a
problem, not a big one.
I've allways been confused about working with dates in
Java. I got a jsp where the user must input a date in
the following format.
Date: dd/mm/  
That's how we use dates in Brazil: the day, month and
year.
I'd like to make a validation if the user input the
date in the correct manner in the ActionForm (i'm
using traditional validation and the user input comes
in a String). So, keeping in mind the variou ways of
doing this date validation (even the deprecated ones),
how should a do the date validation Which one is
the best way??? I just want to check if the user input
a day with 2 digits,  a slash, a month with 2 digits,
a slash and a year with 4 digits.
Also, after that i'd like to copy this form data to my
DTO with BeanUtils. Which type should i use in my DTO 
for this date??? 
Thanks,
Leandro.



___
Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! 
http://br.acesso.yahoo.com/

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



Using Struts Web app with application context....

2004-05-24 Thread Desai, Sunny
Hi there,

Scenario::
I'm using struts in a web application (with other web application which is
non struts). The application context for this new struts application is
myapplication specified in web.xml). 

I'm facing following problems::
1) I initially kept an empty struts-config.xml file (since I there's nothing
common)  my module specific mymodule-struts-config.xml file which has all
the mappings. When I run the application  ask for the mappings in
mymodule-struts-config.xml file, it does not find it. So I debugged into the
struts code which reads all the mappings  puts them in the HashMap (as it
does regularly). But when it processes the request, it does not have those
mappings for some reason. (they've magically disappeared). 

I solved this problem by moving all the mappings from
mymodule-struts-config.xml file to  struts-config.xml file  it works. 

Not having time to investigate more into this problem, I left it as it is.

2) When I create an ActionMessage in my action to dsplay to the user (such
as a confirmation message), the text does not show up on my page.

I discovered that pretty much same thing happens when I debugged into struts
code of creating a message. It reads a message  puts it in the right place
(PageContext). But when it goes to process the tag(html:message) it does
not find that message in PageContext. so it comes back only with Header 
Footer ( no text to display). 

Can somebody help me into this if I'm missing something here. Maybe some
settings of some sort?

-Sunny


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