如
class Project{
private List<ProjectDoc> pds;
setters and getters....
}
class ProjectDoc{
private id;
private name;
private index; //下标
}
class ProjectController{
public String test(Model model){
model.addAttribute("project",project);
}
}问jsp页面怎么获取具体下标的projectDoc.name的值
有一个麻烦的方法但我不行这么做
<c:forEach items="${project.projectDocs}" var="item" >
<c:if test="${item.index==4 }">
<button id="${item.name}" onclick="viewFile(this)">预览</button>
</c:if>
</c:forEach>问有没有简单直接的,比如这种形式的${project.projectDoc[index].name} 获取??
class Project{
private List<ProjectDoc> pds;
setters and getters....
}
class ProjectDoc{
private id;
private name;
private index; //下标
}
class ProjectController{
public String test(Model model){
model.addAttribute("project",project);
}
}问jsp页面怎么获取具体下标的projectDoc.name的值
有一个麻烦的方法但我不行这么做
<c:forEach items="${project.projectDocs}" var="item" >
<c:if test="${item.index==4 }">
<button id="${item.name}" onclick="viewFile(this)">预览</button>
</c:if>
</c:forEach>问有没有简单直接的,比如这种形式的${project.projectDoc[index].name} 获取??
<c:forEach items="${project.pds}" var="item" >
<c:if test="${item.index==4 }">
<button id="${item.name}" onclick="viewFile(this)">预览</button>
</c:if>
</c:forEach>