You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by xianwinwin <xi...@gmail.com> on 2006/10/25 05:21:33 UTC

form bean with composition, is it possible?

Hi guys,

I wonder if it's possible to create a form bean with a composition. I mean,
assuming I have the following classes:
AccountInformation ( fname, lname...) 
CreditCard (number, type...)

I would like to know if I can create a form (registration) that is composed
from AccountInformation and CreditCard???

I don't want to retype all properties again (doesn't sound right)

my question is this:
1. is it possible to do that?
2. if yes, how would the registration.jsp page will look like?

If it was a regular form, it would have been:

		 	
			
		
		
			
			
						
			

thanks for any advise.

-- 
View this message in context: http://www.nabble.com/form-bean-with-composition%2C-is-it-possible--tf2505462.html#a6985533
Sent from the Struts - User mailing list archive at Nabble.com.

Re: form bean with composition, is it possible?

Posted by Yujun Liang <yu...@acm.org>.
public class MyForm extends ValidatorForm {

CreditCard getCreditCard()

}

CreditCard has to be a bean,

jsp.
<html:text name="MyForm" property="creditCard.number"/>
<html:text name="MyForm" property="creditCard.type"/>

Regards

On 10/25/06, xianwinwin <xi...@gmail.com> wrote:
>
>
> Hi guys,
>
> I wonder if it's possible to create a form bean with a composition. I
> mean,
> assuming I have the following classes:
> AccountInformation ( fname, lname...)
> CreditCard (number, type...)
>
> I would like to know if I can create a form (registration) that is
> composed
> from AccountInformation and CreditCard???
>
> I don't want to retype all properties again (doesn't sound right)
>
> my question is this:
> 1. is it possible to do that?
> 2. if yes, how would the registration.jsp page will look like?
>
> If it was a regular form, it would have been:
>
>
>
>
>
>
>
>
>
>
> thanks for any advise.
>
> --
> View this message in context:
> http://www.nabble.com/form-bean-with-composition%2C-is-it-possible--tf2505462.html#a6985533
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>


-- 
Yujun Liang
yujun.liang@acm.org