You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniel Toms <da...@againtech.com> on 2001/04/05 20:50:25 UTC
how to access related ActionForm from within .jsp?
I am having a common problem all over the place.
Struts allows you to associate a bean(the ActionForm)
with a given .jsp. It then magically gets and sets
input fields for you. Great.
But all of the other struts tags require a reference
to a bean by name, using the name="foo" argument
to the tag.
My problem is, I want to reference the bean associated
with my jsp, so that when I want to iterated over a collection
it contains, I can do so without having to know the bean's name.
example:
public final class FooForm extends ActionForm
{
public Collection bar;
public Collection getBar()
{
return bar;
}
public void setBar(Collection b
{
this.bar = b;
}
}
then in my jsp:
<logic:iterate name="???" id="criterion">
<TR>
<TD><bean:write name="criterion" property="propertyName"/></TD>
<TD><bean:write name="criterion" property="operator"/></TD>
<TD><bean:write name="criterion" property="propertyValue"/></TD>
</TR>
</logic:iterate>
So the iterate tag doesn't work because it wants a bean by name, but is
there something I haven't gotten that will make struts use the bean
associated with the jsp and not one specified by name?
thanks,
dan