OK, this isn't real easy to explain, but it's got me stumped at the moment.

I am working on an application that will display hundreds of different
beans.  To cut down on there being hundreds of value beans, I have created a
generic value bean that uses getters and setters like so:

public String getDisplayValue(String propertyName) ...

public void setDisplayValue(String propertyName, String value) ...

no problem so far, my JSPs use <nest:write
property="displayValue(optionId)"/>.  It works just fine.

Now I have can have child objects that occur more 0 to many times. (and
there can be multiples of these, so I need to retrieve the list by type) So,
I have implemented a getter to return an ArrayList like so...

public ArrayList getChildList(String childType) ...

so in my JSP, I have

<nest:root name="optionSet">  <!-- refers to the top level bean -->
   <nest:write property="displayValue(optionId)"/>  <!-- this works fine -->
   
    <!-- now to iterate over the ArrayList for "childTypeB" -->
   <nest:iterate property="childList(childTypeB)"> 
        <nest:write property="displayValue(propA)"/>
        
    <!-- this returns [ServletException in:/WEB-INF/OptionInclude.jsp] No
getter method for property childList(childType)[0].displayValue(propA) of
bean optionSet' -->
   </nest:iterate>
</nest:root>

I can get it to work if I add a <nest:root tag under the iterate..... 

<nest:root name="optionSet"> 
   <nest:write property="displayValue(optionId)"/> 
   
    <!-- now to iterate over the ArrayList for "childTypeB" -->
   <nest:iterate property="childList(childTypeB)" id="child"> 
      <nest:root name="child">
        <nest:write property="displayValue(propA)"/>     <!-- this works -->
     </nest:root>
   </nest:iterate>
</nest:root>

Since the work-around works, it looks a bit like there is a bug using nested
iterate this way.

Also, the work-around fails when I need to use a form and get my results
back...

<nest:root name="optionSet"> 
   <nest:write property="displayValue(optionId)"/> 
   
    <!-- now to iterate over the ArrayList for "childTypeB" -->
   <nest:iterate property="childList(childTypeB)" id="child"> 
      <nest:root name="child">
        <nest:text property="displayValue(propA)"/>    
     </nest:root>
   </nest:iterate>
</nest:root>

since the html generates...

<input type="text" name="displayValue(propA)" value="some text">

since the <nest:root> tag loses track of the parent.

without the <nest:root>  I should get

<input type="text" name="childList(childTypeB)[0].displayValue(propA)"
value="some text">

so that the value will be assigned properly in the actionForm upon return

I'm now suspecting the trouble is with parsing the xxx(childType)[] part of
the expression childList(childType)[0].displayValue(propA) (in particular
the (), and [] together), just a thought.

OK, anyone know what I need to do to get this to work?


       

Reply via email to