It may be better to create a value object containing the Dept DTO and
its respective collection of EmpDetails DTO. Then you don't have to
"jump through hoops" when using Maps.

<logic:iterate id="element" name="formName" property="depts">
<br />
<bean:write name="element" property="dept.deptNo"/>
<bean:write name="element" property="dept.deptName"/>
<logic:iterate id="empElement" name="element" property="employees">
<br />&nbsp;&nbsp;&nbsp;&nbsp;
      <bean:write name="empElement" property="name"/>
      <bean:write name="empElement" property="email"/>
</logic:iterate>
</logic:iterate>



/robert

Sachin Bhutada wrote:

hi, I have a HashMap which has Key and Value both as DTOs


        Key contains Dept DTO (Dept has Dept No, Dept Name)
        Value contains Collection of EmpDetails DTO (It has Name, Email-Id,
etc information)
   In the jsp page I want to iterate through this Map using logic iterate
tag so that outpage html page should look like this..

Dept No : Dept Name
Emp One [EMAIL PROTECTED] .....
Emp Two [EMAIL PROTECTED] .....
and so on Dept No 3 : Dept Name 3
Emp One [EMAIL PROTECTED] .....
Emp Two [EMAIL PROTECTED] .....
and so on ...........


To achieve this, I have written following code. For the time being I am
just concetrating on displaying the Department Details..


<logic:iterate id="element" name="formName" property="deptHashMap">
<br/>
<bean:write name="element" property="key"/> -- IT displayes the
Dept object name


When I try to use following code it shows error message javax.servlet.jsp.JspException: No getter method for property
key.deptNo of bean element <bean:write name="element" property="key.deptNo"/>
</logic:iterate>


In my actionform class I have haspmap and getter and setter methods.

How should I display deptNo and deptName in the Dept DTO ?

Thanks in Advance
Sachin




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



Reply via email to