File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes ActionForm composition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionForm composition" Watch "ActionForm composition" New topic
Author

ActionForm composition

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
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

Joined: Feb 15, 2005
Posts: 4864
<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 ]

Merrill
Consultant, Sima Solutions
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
cool, I 'forgot' to instantiated it (my intuitive semi worked)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ActionForm composition
 
Similar Threads
Need help selected text fields visible for particular option from drop down list in JSP(struts)
can we replace submit button with link in order to submit form ?
Can't get parameter in struts when using input type="file"...?
Newbie in struts (and in english)
How to create text boxes using array/collections using struts tag