【问题标题】:No tag “if” defined in tag library imported with prefix “c”以前缀“c”导入的标签库中没有定义标签“if”
【发布时间】:2014-04-09 05:55:03
【问题描述】:

我有一个使用spring标签的jsp文件。

 <%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> 
 <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> 
 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 


     <c:if  test="${!empty employeeList}"> 
  <table class="data"> 
 <tr> 
<th>FirstName</th>
<th>LastName</th> 
<th>Email</th> 
<th>Telephone</th> 
<th>Action</th> 
</tr> 
<c:forEach items="${employeeList}" var="emp"> 
<tr> 
    <td>${emp.firstname}</td> 
    <td>${emp.lastname}</td>
    <td>${emp.email}</td> 
    <td>${emp.telephone}</td> 
    <td><a href="delete/${emp.id}">Delete</a>|
        <a href="update/${emp.id}">Update</a>
    </td> 
  </tr> 
 </c:forEach> 
 </table> 
 </c:if> 

这是我在标题中提到的错误。我在 tomcat 7 上运行此代码,但如果我在 jBoss 7 上运行它,我不会收到此错误。它让我发疯。请帮忙。

【问题讨论】:

标签: spring tomcat jstl tomcat7


【解决方案1】:

我不知道你得到什么样的错误,但我认为你只是没有导入 javax.servlet。尝试添加到您的 pom.xml 依赖项

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

Tomcat 只是没有额外 jar 的 servlet 容器。 JBoss 是更强大的服务器,并且内置了几乎所有 JEE 库,因此可能是它适用于 JBoss 而不适用于 Tomcat 的原因

【讨论】:

    猜你喜欢
    • 2012-06-28
    • 2012-05-13
    • 2017-03-09
    • 2011-03-13
    • 2019-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多