我认为您正在寻找的是 < c:foreach>标记。
例如,在MyClass实例(如下定义)上打印值myInt属性:
<c:foreach items="${vectors name}" var="pos" > <!-- print the value of myInt for each position of the array. Method getMyInt() must exist in pos object.--> <c:out value="${pos.myInt}"/> <!-- print the value of myInt for each composed instance. Method getRelatedInstance() must exist in pos object. --> <c:out value="${pos.relatedInstance.myInt}"/></c:foreach>
其中 载体名称 是矢量的名称,例如,做一个后
假设您有一个类myClass。
public class MyClass{ private MyClass relatedInstance; //some members and methods public int getMyInt(){ //return something } public MyClass getRelatedInstance(){ return this.relatedInstance;}List<myClass> my_vector = getFilledList();request.setAttribute("vectors name",my_vector)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)