简体   繁体   English

使用JSP EL从bean对象列表中检索bean值

[英]Retrieve bean value from list of bean objects using JSP EL

Below is the request attribute set in struts action 下面是在struts操作中设置的请求属性

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 下面我显示了我如何获取列表。我无法从这行代码中获取值weldtype

<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. 下面的bean在HistoryTeardownHeader类中声明。

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. weldType属性无法从DB正确获取值,因此无法正确反映。

So the EL code given above is actually correct and working fine! 因此,上面给出的EL代码实际上是正确的并且可以正常工作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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