Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Access a Bean's vector datatype which contains another bean in JSTL

843840Jul 27 2008 — edited Jul 30 2008
Am 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2008
Added on Jul 27 2008
10 comments
168 views