according to tld or attribute directive in tag file attribute items does not accept any expressions
2012-11-03 05:14
369 查看
When use Maven to create Liferay portlet project, in the view.jsp. You might want to use jstl/core. When we define that, it'll give us a big error: according to tld or attribute directive in tag file attribute items does not
accept any expressions
Don't worry, we have several things to check.
1. Do you add jstl.jar in your project. Download jstl-1.2.jar and add to your maven project.
2. In your pom.xml, add jstl dependency, otherwise, we need to copy jstl.jar to tomcat/lib/ext folder.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
3. In your jsp, make sure you use <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>, not <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>.
4. check DTD version you use in your web.xml
<web-app version="2.4" 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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
5. use that in your jsp
<c:forEach var="book" items="${books}">
<portlet:renderURL var="editBookURL">
<portlet:param name="myaction" value="editBookForm" />
<portlet:param name="bookId" value="${book.id}" />
</portlet:renderURL>
<portlet:resourceURL var="deleteBookURL">
<portlet:param name="myaction" value="deleteBook" />
<portlet:param name="bookId" value="${book.id}" />
</portlet:resourceURL>
<tr id="myrow_${book.id}">
<td valign="top">${book.id}</td>
<td valign="top">${book.title}</td>
<td valign="top">${book.author}</td>
<td valign="top">${book.isbn}</td>
<td valign="top">${book.summary}</td>
<td align="center" valign="top" width="100px"><a
href="<%=editBookURL%>">EDIT</a> /
<a id="removelink"
href="javascript:void(0)"
onclick="<portlet:namespace/>removeBook('<portlet:resourceURL></portlet:resourceURL>','${book.id}');">Remove</a></td>
</tr>
</c:forEach>
That's all! Well Done!
accept any expressions
Don't worry, we have several things to check.
1. Do you add jstl.jar in your project. Download jstl-1.2.jar and add to your maven project.
2. In your pom.xml, add jstl dependency, otherwise, we need to copy jstl.jar to tomcat/lib/ext folder.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
3. In your jsp, make sure you use <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>, not <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>.
4. check DTD version you use in your web.xml
<web-app version="2.4" 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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
5. use that in your jsp
<c:forEach var="book" items="${books}">
<portlet:renderURL var="editBookURL">
<portlet:param name="myaction" value="editBookForm" />
<portlet:param name="bookId" value="${book.id}" />
</portlet:renderURL>
<portlet:resourceURL var="deleteBookURL">
<portlet:param name="myaction" value="deleteBook" />
<portlet:param name="bookId" value="${book.id}" />
</portlet:resourceURL>
<tr id="myrow_${book.id}">
<td valign="top">${book.id}</td>
<td valign="top">${book.title}</td>
<td valign="top">${book.author}</td>
<td valign="top">${book.isbn}</td>
<td valign="top">${book.summary}</td>
<td align="center" valign="top" width="100px"><a
href="<%=editBookURL%>">EDIT</a> /
<a id="removelink"
href="javascript:void(0)"
onclick="<portlet:namespace/>removeBook('<portlet:resourceURL></portlet:resourceURL>','${book.id}');">Remove</a></td>
</tr>
</c:forEach>
That's all! Well Done!
相关文章推荐
- According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- JSTL Exception: According to TLD or attribute directive in tag file, attribute items does not accept any expressions Solution
- 使用JSTL 报According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute items does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- 关于According to TLD or attribute directive in tag file, attribute value does not accept any expressions异常
- Troubleshooting - Exception: According to TLD or attribute directive in tag file, attribute value does not accept any expressions.
- 使用JSTL tag时出现错误:According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions异常原因及解决方法
- According to TLD or attribute directive in tag file, attribute items does not accept any expression
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- JSP中出现According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions
- JSTL:JSP中出现According to TLD or attribute directive in tag file, attribute value does not accept any expressions