Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActionForm beans and nesting

Status
Not open for further replies.

rdb55

Programmer
Jun 16, 2005
2
US
I've been all over google, and tried searching this website for information on this quandry of mine. I'm confident that nesting works in the presentation side of things, but I've been trying to get the frame work to populate an ActionForm the same way:

<html:text property="customer.firstName"/>

Where the form in question is:

...extends ActionForm {
private Client client;
}

and customer:

class Client {
private String firstName;
}

Both classes have the correct "get/set" pairs for their attributes.

Am I trying to force something that is not supposed to work?
Again, the user hits submit and I want the form populated.

At present I get the following error:

javax.servlet.jsp.JspException: Invalid argument looking up property client.firstName of bean newUserForm
org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:959)
org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:121)

I am using the html: taglib everywhere except on the submit button which is a standard <input.../> tag at the moment.

I've read the Struts docs as well as I can, and have found reference to a sentence like "say you have a customer bean, you can nest the bean in an actionform and use scope resolution to present it". I took that to mean you could also set it using that method. However, I am having no luck in either case.

Thanks for your time,
Randall
Any help is greatly appreciated.
 
Solved my own problem after looking everwhere on the web. Finally found a reference to a "no-brainer" that I had completely forgotten.

If the encapsulated beans are null, then the framework generates a "property not found" exception.

I simply had to instantiate my beans inside of the actionform for it to work as expected.

Ciao
Self
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top