开发者

java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@19ded20 not expected type

开发者 https://www.devze.com 2023-02-13 13:24 出处:网络
I\'m retrieving this exception when I open a JSF page. How is this caused and how can I fix it? org.apache.jasper.JasperException: An exception occurred processing JSP page /searchResultJSF.jsp at li

I'm retrieving this exception when I open a JSF page. How is this caused and how can I fix it?

org.apache.jasper.JasperException: An exception occurred processing JSP page /searchResultJSF.jsp at line 18

15:     <body>
16:         <h1>SEARCH RESULT</h1>
17:       
18:         <h:dataTable id ="abc" value="#{SearchBean.dealerList}" var="dealer">
19:                           <h:column>
20:                               <f:facet name="header" >
21:                                   <h:outputText value="Dealer name "/>


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
    com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@19ded20 not expected type.  Expected: javax.faces.component.UIData.  Perhaps you're missing a tag?
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
    org.apache.jsp.searchResultJSF_jsp._jspService(searchResultJSF_jsp.java:94)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilt开发者_如何学运维er.doFilter(MonitorFilter.java:390)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
    com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

root cause

java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@19ded20 not expected type.  Expected: javax.faces.component.UIData.  Perhaps you're missing a tag?
    com.sun.faces.taglib.html_basic.DataTableTag.setProperties(DataTableTag.java:265)
    javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:604)
    javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1126)
    com.sun.faces.taglib.html_basic.DataTableTag.doStartTag(DataTableTag.java:372)
    org.apache.jsp.searchResultJSF_jsp._jspx_meth_h_005fdataTable_005f0(searchResultJSF_jsp.java:117)
    org.apache.jsp.searchResultJSF_jsp._jspService(searchResultJSF_jsp.java:84)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
    com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)


This is the important bit:

javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@19ded20 not expected type. Expected: javax.faces.component.UIData. Perhaps you're missing a tag?

You forgot to wrap the page with JSF tags within <f:view>. Your page has to look like this:

<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<!DOCTYPE html>
<f:view>
    <html lang="en">
        <head>
            <title>Insert title here</title>
        </head>
        <body>
            Insert content here
        </body>
    </html>
</f:view>
0

精彩评论

暂无评论...
验证码 换一张
取 消