BeanUtils inside Struts can't deal with the two indexes back to back ("[i][k]").

The reason why the original <logic:iterate> works, is because it cheats (yes,
it cheats). Because it doesn't care about its children, all it does is get the
collection using "childs[1]" and then makes a bean. It's this bean you're
using in the write methods.

Whereas, the nested tags simply organise the properties and then pass it to
where it's being used, in this case the write tags, with property
"groups.childs[1][0].name". But as I mentioned, bean utils can't handle it.

To get it working, you'll need to wrap the second collection in a simple bean
so you can get at it with another property like "groups.childs[1]another[0].name".

Hopefully it wont be too much of a refactor, but beanUtils can't play with it
as-is.

All the best.

Arron.



> Hi all ! 
> 
> My jsp contain the following code :
> 
> <nested:form action="/admin.gp?ACTION=getGroups"
type="gaston.project.struts.user.AdminAction" name="SESSIONUSER">
>  <nested:nest property="groups" >
>     <nested:write property="root.name"/><br>                           (A)
>     <nested:iterate property="childs[1]">                                  
  (B)
>       <nested:write property="name"/><br>
>   </nested:iterate>
>  </nested:nest>
> </nested:form>
> 
> the error related to the line (B) is : 
> javax.servlet.ServletException: No getter method for property
groups.childs[1][0].name of bean SESSIONUSER
> at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471)
>  
> I've several hypothesis according to this but nevertheless I can't go
further :-(
> 
> for info, the following code works well :
> 
> <logic:iterate id="thegroups" name="SESSIONUSER" property="groups.childs[1]">
> <bean:write name="thegroups" property="name"/>
> <br>
> </logic:iterate>
> 
> and ... I need nested tags for recursion and I don't want to change the
implementation of my bean wich uses an hashtable to record the child
node/parent node relations
> 
> ... and an another simple related question (wich, I guess, doesn't need a
new thread for it) : how do I write "childs[id]" instead of "childs[1]" ? ...
 property="<%='child['+id+']'%>" doesn't work and I don't know how to manage
this with <nested:define>'s tag
> 
> thanks for help
> 
> JM
> 
> ps : I've already take a look at www.keyboardmonkey.com ;-)





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

Reply via email to