Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 找不到与from view id匹配的导航案例_Jsf_Jsf 2.2 - Fatal编程技术网

Jsf 找不到与from view id匹配的导航案例

Jsf 找不到与from view id匹配的导航案例,jsf,jsf-2.2,Jsf,Jsf 2.2,我正在尝试实现简单的页面导航。所以,每当我点击登录按钮时,它应该简单地将我重定向到欢迎页面并显示欢迎消息 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"> &

我正在尝试实现简单的页面导航。所以,每当我点击登录按钮时,它应该简单地将我重定向到欢迎页面并显示欢迎消息

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>External Resources</title>        
    </h:head>
    <h:body>
        <ui:composition template="/WEB-INF/templates/template.xhtml">
            <ui:define name="css">
                <h:outputStylesheet library="css" name="index.css"/>
            </ui:define>
            <ui:define name="content">
                <h1>Welcome to Login Page</h1>
                    <h:form id="login-form" prependId="false">
                        <h:panelGrid columns="5">
                            <h:outputLabel for="username" value="Username"/>
                  <h:inputText id="username" value="#{loginBean.user.username}" />

                            <h:outputLabel for="password" value="Password"/>
                <h:inputSecret id="password" value="#{loginBean.user.password}" />

                            <h:commandButton value="Login" id="cmdButton" 
                            action="#{loginBean.goToWelcome()}"/>
                        </h:panelGrid>
                    </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
错误显示:-

Unable to find matching navigation case with from-view-id 
'/index.xhtml' for action '#{loginBean.goToWelcome()}' with outcome 
'/pages/welcome?faces-redirect=true'

有很多方法可以返回页面


非常简单的一个:在backingBean中返回如下页面:


返回“DesiredPage.xhtml”返回页面的方法有很多


非常简单的一个:在backingBean中返回如下页面:

返回“DesiredPage.xhtml”
Unable to find matching navigation case with from-view-id 
'/index.xhtml' for action '#{loginBean.goToWelcome()}' with outcome 
'/pages/welcome?faces-redirect=true'