简体   繁体   中英

Retrieve bean value from list of bean objects using JSP EL

Below is the request attribute set in struts action

ArrayList<HistoryTeardownHeader> list = new ArrayList<HistoryTeardownHeader>();
// add values to list 
request.setAttribute("tdbList",list);

Below i have shown how i am getting the list.I am not able to get the value weldtype from this line of code

<c:forEach var="post" items="${requestScope.tdbList}">
<c:out value="${ post.weldType}"></c:out>
<html:hidden property="currentWeld" value="${post.weldType}"/>
</c:forEach>

The below bean is declared in the HistoryTeardownHeader class.

private String weldType;

public String getWeldType() {
    return weldType;
}
public void setWeldType(String weldType) {
    this.weldType = weldType;
}

Sorry Guys!

The weldType property didnt fetch the value from DB correctly so it didnt reflect correctly.

So the EL code given above is actually correct and working fine!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM