I'm facing a situation where ideally I'd like to have a single ActionForm
like so:

public class MyActionForm extends ActionForm {
  AnotherActionForm1 af1;
  AnotherActionForm2 af2;
}

When in my JSP I do:

<html:text property="af1.field1" />

...I do indeed see the value as I expect.  The way I did this is to have
an Action mapping that references MyActionForm, then within the Action I
instantiate AnotherActionForm1, set the value of field1 on it, and then
set af1 to that new AnotherActionForm1 instance.  That all works nicely.

Here's where I run into a problem...

On the page I basically have 2 separate HTML forms, one for
AnotherActionForm1 and another for AnotherActionForm2.  However, I have a
SINGLE submit button at the end (just plain button that makes an AJAX
request).  onClick of that button, I create a query string from the values
of both forms, and make a request to the server with the query string
attached.  The parameter names of the query string arguments are
af1.field1 and af2.field2, mimicing what's in MyActionForm.  The mapping
that the request goes to again references MyActionForm.

What I've been told should happen is that Struts should be able to
instantiate those two nested beans and set the properties, since the
parameter names give it the information it needs.  This does not however
seem to be happening.

So, two questions... first, is that in fact the expected behavoir?  And
two, if so, any ideas what I'm doing wrong?  I can post all the pertinent
config and code, but thought it might be something more generic that
wouldn't require all that.  This is the first time I've ever had a need to
nest forms like this, so it's a new question for me.

Thanks all!

Frank


-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to