0

我们在 JBOSS 4.0.2 的 jsp 中使用 JSTL。使用标签库时,我们遇到以下异常。在本地部署在 tomcat 7 上但部署在服务器 jboss 上时不会发生错误

javax.servlet.ServletException: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:272)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:240)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:258)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1174)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)

root cause

java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
    org.apache.jasper.compiler.TagLibraryInfoImpl.createAttribute(TagLibraryInfoImpl.java:572)
    org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:401)
    org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:248)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:179)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1543)
    org.apache.jasper.compiler.Parser.parse(Parser.java:126)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:240)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:258)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1174)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)

这是 JSP 代码:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<div>
<table>
<tr>
<th>Question name</th>
<tr>
    <c:forEach var="questions" items="${questionslist}">
                <tr>
                    <td><c:out value="${questions.Question}"  /></td>
                                   </tr>

                </c:forEach>
</table>
</div>
</body>
4

1 回答 1

0

据我所知,JBoss 4.0.2 没有嵌入 JSTL 库。将 jstl.jar 和 standard.jar 添加到应用程序的 lib 文件夹中。下载,取决于您要使用的 JSTL 版本:

于 2013-04-21T21:29:05.060 回答