0

JSP tag code is:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ attribute name="items" required="true" %>
${items[0]}

JSP code is:

<%@ taglib prefix="t" tagdir="/WEB-INF/tags"%>
<t:input items="${form.items}"></t:input>

Maybe I forgot type of the attribute or something else? Why is the way to access values different in JSP and JSP tag?

4

1 に答える 1

0

The default type of attributes is java.lang.String. If you expect something else, specify the expected type:

<%@ attribute name="items" required="java.util.Collection" %>

or

<%@ attribute name="items" required="java.lang.Object" %>

for example.

于 2012-06-30T15:45:34.153 に答える