Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionForm composition

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just wonder if it's to create a form bean with a composition. Assuming I have the following classes:
AccountInformation ( fname, lname...)
CreditCard (number, type...)

I would like to know if it possible to create a form (registration) that is composed of 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:


I would like too change the property to somthing like this:
<html:text property="creditCard.ccNumber"> (that of course, doesn't work)

thanks for any advise.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<html:text property="creditCard.ccNumber"> (that of course, doesn't work)


That does work if you've set up your ActionForm bean properly. Example:


If you code your Actionform like this, the above <html:text> tag will work as long as the CreditCard class has a ccNumber property.
[ October 24, 2006: Message edited by: Merrill Higginson ]
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cool, I 'forgot' to instantiated it (my intuitive semi worked)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic