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'