http://community.youkuaiyun.com/Expert/topic/4320/4320301.xml?temp=.4254419
参见struts1.1源代码/src/share/org/apache/taglib/logic/IterateTag.java
// Store the first value and evaluate, or skip the body if none
if (iterator.hasNext()) {
Object element = iterator.next();
if (element == null) {
pageContext.removeAttribute(id);
} else {
pageContext.setAttribute(id, element);
}
lengthCount++;
started = true;
if (indexId != null) {
pageContext.setAttribute(indexId, new Integer(getIndex()));
}
return (EVAL_BODY_TAG);
} else {
return (SKIP_BODY);
}
中的pageContext(javax.servlet.jsp.PageContext)
可以用pageContext取到indexId的值
<%=(Integer)pageContext.getAttribute("indexid")%>
tomcat5下的web应用程序,默认情况下是不支持EL表达式的,如果你想使用EL表达式的话,需要做以下事情
方法一
在每个jsp页面添加<%@ page isELIgnored="false" %>
方法二
修改web.xml中的<web-app>标记为
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee-web-app_2_4.xsd" version="2.4">
这样就OK了