You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by pr...@seepz.tcs.co.in on 2003/07/22 06:16:56 UTC
Nested Bean Problem
Hi,
I have a problem handling nested beans..
For example...
I have a userBean as given below
private int userID;
private String lastName;
private String firstName;
private ArrayList roleUser;
Where the last field Arraylist is the arraylist of the objects of the bean
called roleUserBean.
Again the roleUserBean has the following properties.
private int roleid;
private String desc;
private String name;
private ArrayList menuComponent;
The last property menuComponent is the arrayList of objects of the bean
called menuComponentBean.
Now the menuComponentBean contains
private int menuID;
private String menuName;
private String description;
I have put the userBean in the session scope. But I don't know how can I
drill down from the userBean to one of the menuName. I want to display the
menu dynamically getting the menu items from the userBean.
How can I use the <logic:iterate> tag to get all the menuNames from the
userBean? Or is there any other efficient way in which I can get the
menuNames to be displayed in my JSP(view) part.
Thanks in advance.
Prashant M Desai.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Nested Bean Problem
Posted by Nagendra Kumar O V S <na...@ikigo.com>.
hi,
here goes the piece of code
<logic:iterate name="userBean" scope="session" id="userbean">
<nested:write property="userID"/>
<nested:write property="lastName"/>
<nested:write property="firstName"/>
<nested:iterate property="roleUser" id="roleuser">
<nested:write property="roleid"/>
<nested:write property="desc"/>
<nested:write property="name"/>
<nested:iterate property="menuComponent" id="menucomp">
<nested:write property="menuID"/>
<nested:write property="menuName"/>
<nested:write property="description"/>
</nested:iterate>
</nested:iterate>
</logic:iterate>
hoep this helps
-- nagi
-------Original Message-------
From: Struts Users Mailing List
Date: Tuesday, July 22, 2003 09:45:44 AM
To: Struts Users Mailing List
Subject: Nested Bean Problem
Hi,
I have a problem handling nested beans..
For example...
I have a userBean as given below
private int userID;
private String lastName;
private String firstName;
private ArrayList roleUser;
Where the last field Arraylist is the arraylist of the objects of the bean
called roleUserBean.
Again the roleUserBean has the following properties.
private int roleid;
private String desc;
private String name;
private ArrayList menuComponent;
The last property menuComponent is the arrayList of objects of the bean
called menuComponentBean.
Now the menuComponentBean contains
private int menuID;
private String menuName;
private String description;
I have put the userBean in the session scope. But I don't know how can I
drill down from the userBean to one of the menuName. I want to display the
menu dynamically getting the menu items from the userBean.
How can I use the <logic:iterate> tag to get all the menuNames from the
userBean? Or is there any other efficient way in which I can get the
menuNames to be displayed in my JSP(view) part.
Thanks in advance.
Prashant M Desai.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
.