Something like: ... private java.util.Date date = null;
...
public java.util.Date getDate() {
return this.date;
}
//Also create a pre-formatted String of the Date Object
public String getFormattedDate() {
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
return formatter.format(getDate());
}
...
Giovani Salvador wrote:
Donīt worry Hubert....well, i will try explain more detailed....
I have a jsp page with the following tag
<html:text name="projeto" property="dtIniRealProjeto" maxlength="10" size="10" />
Ok, the attribute "name" means that my object has the name "projeto". Itīs a DTO that an action class put in the request. Well, the html:text will render an input text catching the value from the "dtIniRealProjeto" attribute of my object "project". But this attribute is of Calendar type. Then, what appear in the browser is the instance representation of this calendar, no the date values. So i want to format this values before presentation and make the html:text show the formatted data.
Thatīs the problem, one solution could be using the action form but if i have a DTO with the values, why must i have to copy all values back to Action Form? Donīt you thin this is time-consuming, cpu-consuming, memory-consuming?
I think the major question is: How can i use the html:text to get value from an object (DTO or Action Form) and FORMAT it????
I have seen in the archives many questions and no real answer.
Thanks
Giovani Salvador
----- Original Message ----- From: "Hubert Rabago" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, January 08, 2004 4:27 PM
Subject: Re: html:text and converter
Yes, that last msg wasn't much help. Maybe if you provide a biggerpicture of
the situation, other folks can give you alternatives. Or at least helpconvince
you of the advantages to using AFs.use
--- Hubert Rabago <[EMAIL PROTECTED]> wrote:
Perhaps it's time to consider using AFs. :)
--- Giovani Salvador <[EMAIL PROTECTED]> wrote:
The problem is that i am not showing the data with the action form. I
ActionForm. Ifthe html:text to read directly from my DTO and, unfortunatly, no conversion is made. :(
Giovani Salvador
----- Original Message ----- From: "Hubert Rabago" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, January 08, 2004 3:14 PM
Subject: Re: html:text and converter
You'll have to format the data that you're passing to your
canyou're
extending from ActionForm (but not using a Dyna form), perhaps you
getField()format the
data in your setField() method, or before returning from a
problem ismethod.
--- Giovani Salvador <[EMAIL PROTECTED]> wrote:
Hi all...
Is there a way to force that html:text call a converter? My
tothat i
am trying to format
a date before showing it with html:text tag and a possible way is
thatpass by
the StringConverter class,
for example. By debugging the jakarta commons beans i perceveid
this call
is not made. Any tip on how to force passing by the StringConverter?
Thanks.
Giovani Salvador
__________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
__________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
--------------------------------------------------------------------- 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]