简体   繁体   English

h:dataTable抛出java.lang.NoClassDefFoundError:javax / servlet / jsp / jstl / sql / Result

[英]h:dataTable throws java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/sql/Result

This is my table: 这是我的桌子:

<h:dataTable value="#{registerS.students}" var="registerS.student">
 <h:column>                 
    <f:facet name="header">Name</f:facet>                   
    #{registerS.student.userName}
 </h:column>
 <h:column>
    <f:facet name="header">Surname</f:facet>
    #{registerS.student.userSurname}
 </h:column>
 <h:column>
    <f:facet name="header">email</f:facet>
    #{registerS.student.email}
 </h:column>
 <h:column>
    <f:facet name="header">password</f:facet>
    #{registerS.student.password}
 </h:column>
 <h:column>
    <f:facet name="header">classCode</f:facet>
    #{registerS.student.classCode}
 </h:column>
</h:dataTable>

When opening a page with this page, I get this exception: 当打开带有该页面的页面时,出现以下异常:

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/sql/Result
    javax.faces.component.UIData.getDataModel(UIData.java:1822)
    javax.faces.component.UIData.setRowIndexWithoutRowStatePreserved(UIData.java:484)
    javax.faces.component.UIData.setRowIndex(UIData.java:473)
    com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:82)
    javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:869)
    javax.faces.component.UIData.encodeBegin(UIData.java:1133)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854)
    javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
    javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
    com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

How is this caused and how can I solve it? 这是怎么引起的,我该如何解决?

JSF has a dependency on JSTL for several things. JSF在某些方面依赖于JSTL One of them is inspecting which DataModel should be used behind <h:dataTable value> . 其中之一是检查在<h:dataTable value>之后应使用哪个DataModel It also supports JSTL <sql:query var="result"> (which is discouraged since a decade, but that aside). 它还支持JSTL <sql:query var="result"> (十年以来不鼓励这样做,但除此之外)。

Apparently you're running a barebones servletcontainer instead of a real Java EE server. 显然,您正在运行准系统servlet容器而不是真正的Java EE服务器。 The stack trace hints that it's Tomcat . 堆栈跟踪提示它是Tomcat It ships only Servlets, JSP, EL and WS out the box. 它仅提供Servlet,JSP,EL和WS。 It doesn't ship all other Java EE stuff out the box such as JSF, JSTL, CDI, EJB, JPA, JTA, JMS, etc..etc.. You have to install it manually (or just move to a real Java EE server such as TomEE or WildFly ). 它不会立即提供所有其他Java EE内容,例如JSF,JSTL,CDI,EJB,JPA,JTA,JMS等。等等。您必须手动安装(或仅移至真正的Java EE)服务器,例如TomEEWildFly )。

You can find a link to the correct JSTL JAR and the correct Maven dependency in "Installing JSF" section of our JSF wiki page . 您可以在我们的JSF Wiki页面的 “安装JSF”部分中找到指向正确的JSTL JAR和正确的Maven依赖关系的链接。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config - java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config java.lang.NoClassDefFoundError: javax/faces/FacesException - java.lang.NoClassDefFoundError: javax/faces/FacesException Tomcat 7找不到我的类抛出javax.el.E​​LException:java.lang.NoClassDefFoundError - Tomcat 7 can't find my class throws javax.el.ELException: java.lang.NoClassDefFoundError java.lang.NoClassDefFoundError: javax/faces/context/FacesContextFactory - java.lang.NoClassDefFoundError: javax/faces/context/FacesContextFactory java.lang.NoClassDefFoundError:com / sun / faces / facelets / tag / jstl / core / IterationStatus - java.lang.NoClassDefFoundError: com/sun/faces/facelets/tag/jstl/core/IterationStatus JAR中的beans.xml导致java.lang.NoClassDefFoundError:javax.faces.component.behavior.Behavior - beans.xml in JAR causes java.lang.NoClassDefFoundError: javax.faces.component.behavior.Behavior JSF 2.2流和Tomcat 7 java.lang.NoClassDefFoundError:javax / enterprise / context / spi / Context - JSF 2.2 Flows and Tomcat 7 java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Context java.lang.NoClassDefFoundError:javax / faces / FacesWrapper错误,尽管所需的类已添加到RichFaces中的项目类路径中 - java.lang.NoClassDefFoundError: javax/faces/FacesWrapper error though the required classes been added to the project classpath in RichFaces java.lang.NoClassDefFoundError:运行SimpleHelloByEnteringName时的javax / el / ELResolver JSF示例 - java.lang.NoClassDefFoundError: javax/el/ELResolver when running SimpleHelloByEnteringName JSF example 升级到大气2.4.0时遇到此错误java.lang.NoClassDefFoundError javax / websocket / DeploymentException - facing this error when upgrading to atmosphere 2.4.0 java.lang.NoClassDefFoundError javax/websocket/DeploymentException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM