Mark Lowe
Thu, 25 Mar 2004 15:59:47 -0800
* Based on experience with any garden variety GUI application, the user will expect that they receive an error message, plus a redisplay of the form ***WITH THE INCORRECT VALUES THAT WERE ENTERED DISPLAYED SO THE USER CAN CORRECT THEM***.
* The current Struts environment will throw an exception due to the conversion failure.
* The suggested solution will ***hopelessly*** confuse the nature of a form bean, which is part of the VIEW tier, with model beans that have native data types.
Application Tier is strongly typed.
So if the field is a java.util.Date in the database, then the data object will have the method
public DataObject{ public java.util.Date getAsOfDate() public void setAsOfDate(java.util.Date asOfDate) methods. }
My Action form is:
public MyActionForm extends ActionForm{ public DataObject getDataObject(); public void setDataObject(DataObject dataObject); }
My jsp contains
<html:text property="dataObject.asOfDate"/>
This will fail if the user does not enter any date. I want the (changed) struts framework to handle that.
I did not want to create a new method with type String for every Date field
Hope this explanation helps !!
Thanks and Regards, Sree/-
----------------------------------------------------------------------- -----------------
This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose.
----------------------------------------------------------------------- -----------------
Mark Lowe <mark.lowe @boxstuff.com>
03/25/2004 03:17 PM Please respond to "Struts Users Mailing List"
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
cc:
Subject: Re: Handling Date objects in ActionForm gracefully
Ask yourself why are you trying to convert types for user input?
On 25 Mar 2004, at 21:11, Sreenivasa Chadalavada wrote:
> Do you know if the behavior can be overridden?
>
> Thanks and Regards,
> Sree/-
>
>
> -----------------------------------------------------------------------
> -----------------
> This is a PRIVATE message. If you are not the intended recipient,
> please
> delete without copying and kindly advise us by e-mail of the mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit
> written agreement or government initiative expressly permitting the
> use of
> e-mail for such purpose.
> -----------------------------------------------------------------------
> -----------------
>
>
>
>
>
> "Takhar, Sandeep" <Sandeep.Takhar
> @CIBC.ca>
> 03/25/2004 02:53 PM
> Please respond to "Struts Users Mailing List"
>
>
> To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> cc:
> Subject: RE: Handling Date objects in ActionForm
> gracefully
>
>
> yes it is. It should be done once per classloader.
>
> When struts populates the dyna form it is string array to string array
> conversion and uses
> populate method of BeanUtils which eventually calls the converters.
>
> sandeep
>
> -----Original Message-----
> From: Sreenivasa Chadalavada [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 25, 2004 2:47 PM
> To: Struts Users Mailing List
> Subject: Re: Handling Date objects in ActionForm gracefully
>
>
> I am thinking of overriding the struts default mechanism.
> Override the default behavior of
> org.apache.commons.beanutils.ConvertUtils
>
> by registering
> a valid converter...
>
> I want to know if the above is possible..
>
> Thanks and Regards,
> Sree/-
>
>
> -----------------------------------------------------------------------
> -----------------
> This is a PRIVATE message. If you are not the intended recipient,
> please
> delete without copying and kindly advise us by e-mail of the mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit
> written agreement or government initiative expressly permitting the
> use of
>
> e-mail for such purpose.
> -----------------------------------------------------------------------
> -----------------
>
>
>
>
>
> Mark Lowe <mark.lowe
> @boxstuff.com>
> 03/25/2004 02:36 PM
> Please respond to "Struts Users Mailing List"
>
>
> To: "Struts Users Mailing List"
> <[EMAIL PROTECTED]>
> cc:
> Subject: Re: Handling Date objects in ActionForm
> gracefully
>
>
> Have it as a string and convert it to a date or calendar when you pass
> it back to the model.
>
>
> On 25 Mar 2004, at 20:28, Sreenivasa Chadalavada wrote:
>
>> All,
>>
>> We are facing a problem when we define java.util.Date field in
>> ActionForm.
>>
>> Is there any way to override the default behavior provided by Struts?
>>
>> I very much appreciate your help!!
>>
>> Thanks and Regards,
>> Sree/-
>>
>>
>> ----------------------------------------------------------------------
>> -
>> -----------------
>> This is a PRIVATE message. If you are not the intended recipient,
>> please
>> delete without copying and kindly advise us by e-mail of the mistake
>> in
>> delivery. NOTE: Regardless of content, this e-mail shall not operate
>> to
>> bind CSC to any order or other contract unless pursuant to explicit
>> written agreement or government initiative expressly permitting the
>> use of
>> e-mail for such purpose.
>> ----------------------------------------------------------------------
>> -
>> -----------------
>
>
> ---------------------------------------------------------------------
> 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]