struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: changing ActionForm to be a Java interface
Date Wed, 15 Jan 2003 20:27:07 GMT

On Wed, 15 Jan 2003, K.Viswanathan wrote:

> Date: Wed, 15 Jan 2003 11:15:49 +0530
> From: K.Viswanathan <>
> Reply-To: Struts Users Mailing List <>
> To: Struts Users Mailing List <>
> Subject: Re: changing ActionForm to be a Java interface
> In this example, assuming that the employee id is long ( or for that matter
> any other attribute of Employee , say age of int type ) , then will it not
> be incorrect to have the EmployeeForm implementing  Employee interface?
> Doing so the EmployeeForm is basically having a property of long/int type
> rather than a String?

That's exactly one of the problems you would run into if ActionForm were
an interface.  The underlying class would want the id property to be a
long, but the form bean wants it to be a String.  The only way around that
in a single class would be to use two different property names (id and
idAsString perhaps) and remembering to do the conversion at the right time
-- which pretty much defeats the reason for making a single class
implement both interfaces anyway.

> Thanks
> Vishy


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

View raw message