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

Reply via email to