Access a Bean's vector datatype which contains another bean in JSTL
843840Jul 27 2008 — edited Jul 30 2008Am new to JSTL. Am trying to convert Scriplet code to JSTL and my problem is, am not able to get the value of the bean with in the vector which is inside another bean.
hope the below example will explain further:
My code with scriplet - working code*
<%
Vector hostInfVec = (Vector)avSummObj.getHostInfo();
for(int i=0; i<hostInfVec.size(); i++){
hostInfoObj = (HostInfoBean)hostInfVec.get(i);
%>
<tr class="altRowColor">
<td width="88"><%=hostInfoObj.getHostName()%></td>
<td width="51"><%=hostInfoObj.getPort()%></td>
<td class="numericalCell" width="46"><%=hostInfoObj.getCmdDev()%></td>
<td class="numericalCell"><%=hostInfoObj.getDevFile()%></td>
</tr>
<%
}
%>
convertion of above scriplet to jstl: - not working*
check:::: ${ArrayViewSummary.hostInfo} // this is printing the objects inside the vector
<c:forEach items='${ArrayViewSummary.hostInfo}' var='hostInfo'>
<tr class="altRowColor">
<td width="88">${hostInfo.hostName}</td>
<td width="51">${hostInfo.port}</td>
<td class="numericalCell" width="46">${hostInfo.cmdDev}</td>
<td class="numericalCell">${hostInfo.devFile}</td>
</tr>
</c:forEach>
To explain further, AVBean has a datatype hostInfo as vector, the hostInfo vector contains a collection of HostInfoBean. I want to access HostInfoBean's values (hostName, port, cmdDev, devFile