简体   繁体   English

java.lang.IllegalStateException:组件javax.faces.component.UIViewRoot不是预期的类型

[英]java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot not expected type

I have a JSP file with JSF components index.jsp : 我有一个包含JSF组件index.jsp的JSP文件:

<body>  
        <h:form prependId="false">
                <h:panelGrid id="panelLogin" columnClasses="colLabel,colValor" columns="2">
                    <f:facet name="header">
                        <h:outputText value="Panel de Log-In" />
                    </f:facet>

                    <h:outputLabel value="Usuario" for="txtNombre" />
                    <h:inputText id="txtNombre" value="#{manejadorLogin.usuario}" />
                    <h:outputLabel value="Password" for="txtPassword" />
                    <h:inputText id="txtPassword" value="#{manejadorLogin.password}" /> 

                    <f:facet name="footer">
                        <h:panelGrid  columns="2">
                            <h:commandButton value="Login"  action="#{manejadorLogin.loginUsuario}" />
                            <h:commandButton value="Limpiar" type="reset"  />                                            
                        </h:panelGrid>
                    </f:facet>
                </h:panelGrid> 
        </h:form>
    </body>

When I press the "Login" button, I get this error: 当我按下“登录”按钮时,出现此错误:

An Error Occurred: java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@7cf94d3b not expected type. 发生错误:java.lang.IllegalStateException:组件javax.faces.component.UIViewRoot@7cf94d3b不是预期的类型。 Expected: javax.faces.component.UIOutput. 预期:javax.faces.component.UIOutput。 Perhaps you're missing a tag? 也许您缺少标签?

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

An Error Occurred: java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@7cf94d3b not expected type. 发生错误:java.lang.IllegalStateException:组件javax.faces.component.UIViewRoot@7cf94d3b不是预期的类型。 Expected: javax.faces.component.UIOutput. 预期:javax.faces.component.UIOutput。 Perhaps you're missing a tag? 也许您缺少标签?

The <f:view> tag is missing in the JSP file where this action is navigating to. 此操作导航到的JSP文件中缺少<f:view>标记。 If you're using legacy JSP as view technology instead of its successor Facelets, then you need to make sure that all JSF components are enclosed inside a parent <f:view> tag (which is behind the scenes represented by UIViewRoot component). 如果您使用遗留的JSP作为视图技术而不是其后继的Facelets,则需要确保所有JSF组件都包含在父<f:view>标记内(该标记位于UIViewRoot组件所代表的幕后)。

You need to change your JSP file to match the following basic template (note the <f:view> ): 您需要更改JSP文件以匹配以下基本模板(请注意<f:view> ):

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html>
<f:view>
    <html lang="en">
        <head>
            <title>JSP page with JSF components</title>
        </head>
        <body>
            <h:outputText value="JSF components here." />
        </body>
    </html>
</f:view>

暂无
暂无

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

相关问题 java.lang.IllegalStateException:组件javax.faces.component.UIViewRoot@19ded20不是预期类型 - java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@19ded20 not expected type java.lang.IllegalStateException:Parent不为null,但此组件不相关 - java.lang.IllegalStateException: Parent was not null, but this component not related 无法将类型为java.lang.String的#{ad.userid}转换为类javax.faces.component.UIComponent - Cannot convert #{ad.userid} of type class java.lang.String to class javax.faces.component.UIComponent 消息 java.lang.IllegalStateException: 没有输出文件夹 - message java.lang.IllegalStateException: No output folder TokenHelper 中的 setSessionToken 抛出 java.lang.IllegalStateException - java.lang.IllegalStateException thrown while setSessionToken in TokenHelper 响应已提交-java.lang.IllegalStateException:UT010019 - Response already commited - java.lang.IllegalStateException: UT010019 JSTL导入标记抛出带有相对URL的java.lang.IllegalStateException - JSTL import tag throws java.lang.IllegalStateException with relative URL 休眠-线程“主”中的异常java.lang.IllegalStateException - Hibernate - Exception in thread “main” java.lang.IllegalStateException 无法修复java.lang.IllegalStateException:无法检索unitName的EntityManagerFactory - Unable to fix java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName java.lang.IllegalStateException造成什么危害:响应已经提交 - What harm is caused by java.lang.IllegalStateException: Response already committed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM