根据 TLD,forEach 标签的属性值无效
Attribute value invalid for tag forEach according to TLD
我有这个代码
<c:forEach var="l" value="${logs}">
...
</c:forEach>
它说:
Attribute value invalid for tag forEach according to TLD
forEach
标签不支持 value
属性。 IE。 <c:forEach value>
无法识别。真的,这基本上就是错误试图告诉你的。
如果你查阅the documentation of the forEach
tag,你会发现 value
属性确实在属性 table 中没有提到。仅列出以下属性:
items
- Collection of items to iterate over.
begin
- If items specified: Iteration begins at the item located at the specified index. First item of the collection has index 0. If items not specified: Iteration begins with index set at the value specified.
end
- If items specified: Iteration ends at the item located at the specified index (inclusive). If items not specified: Iteration ends when index reaches the value specified.
step
- Iteration will only process every step items of the collection, starting with the first one.
var
- Name of the exported scoped variable for the current item of the iteration. This scoped variable has nested visibility. Its type depends on the object of the underlying collection.
varStatus
- Name of the exported scoped variable for the status of the iteration. Object exported is of type javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility.
猜猜你真正需要哪一个。如果您不确定,Java EE tutorial 可能会有所帮助。
我有这个代码
<c:forEach var="l" value="${logs}">
...
</c:forEach>
它说:
Attribute value invalid for tag forEach according to TLD
forEach
标签不支持 value
属性。 IE。 <c:forEach value>
无法识别。真的,这基本上就是错误试图告诉你的。
如果你查阅the documentation of the forEach
tag,你会发现 value
属性确实在属性 table 中没有提到。仅列出以下属性:
items
- Collection of items to iterate over.begin
- If items specified: Iteration begins at the item located at the specified index. First item of the collection has index 0. If items not specified: Iteration begins with index set at the value specified.end
- If items specified: Iteration ends at the item located at the specified index (inclusive). If items not specified: Iteration ends when index reaches the value specified.step
- Iteration will only process every step items of the collection, starting with the first one.var
- Name of the exported scoped variable for the current item of the iteration. This scoped variable has nested visibility. Its type depends on the object of the underlying collection.varStatus
- Name of the exported scoped variable for the status of the iteration. Object exported is of type javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility.
猜猜你真正需要哪一个。如果您不确定,Java EE tutorial 可能会有所帮助。