Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.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无法为已经存在的ressource提供服务_Jsf_Jsf 2_Navigation - Fatal编程技术网

JSF无法为已经存在的ressource提供服务

JSF无法为已经存在的ressource提供服务,jsf,jsf-2,navigation,Jsf,Jsf 2,Navigation,我有一个JSF应用程序,带有登录名 <h:commandButton id="btnLoginId" value="Login" action="#{UserLoginMB.login}" styleClass="loginPanelBtn"></h:commandButton> 之后,报税表上写着: 不可能航行的相关部门ID de vue«/home/index.xhtml»pour l'action«#{UserLoginMB.login}»avec 勒雷苏丹«正确

我有一个JSF应用程序,带有登录名

<h:commandButton id="btnLoginId" value="Login" action="#{UserLoginMB.login}" styleClass="loginPanelBtn"></h:commandButton>
之后,报税表上写着:

不可能航行的相关部门ID de vue«/home/index.xhtml»pour l'action«#{UserLoginMB.login}»avec 勒雷苏丹«正确»

这意味着找不到与view home/index.xhtml的ID相对应的导航方式来执行操作(Bean.login),结果为“correct”

虽然我已将Faces配置设置为在出现成功结果(正确返回)时重定向到/home/backend/index.xhtml


/home/index.xhtml
#{userLoginMB.login}
对的
/home/backend/index.xhtml
在apache日志中:

避免:JSF1064:不可能消除本地化和服务 ressource,/home/correct.xhtml

这意味着不可能本地化ressource/home/correct.xhtml,而我从未使用过这样的ressource。

如果
不完全匹配(它们区分大小写!),那么JSF就无法找到与所需结果相关的
。然后JSF将默认为隐式导航,这意味着返回的字符串将被视为

因此,在例如

public String login() {
    // ...
    return "correct";
}
并且找不到
,那么JSF将隐式导航到与当前视图位于同一文件夹中的
correct.xhtml
。这个特性是自JSF2.0以来的新特性,它避免了开发人员编写所有包含导航案例的XML样板文件。在您的特定情况下,您也可以只返回
“backend/index”
,而不使用导航案例

另见:

我已经得到了纠正,无论如何,我会选择这个作为答案。
    <!-- navigation-rule for login.xhtml -->
    <navigation-rule>
        <from-view-id>/home/index.xhtml</from-view-id>
        <!-- navigation-case for method login() -->
        <navigation-case>
            <from-action>#{userLoginMB.login}</from-action>
            <from-outcome>correct</from-outcome>
            <to-view-id>/home/backend/index.xhtml</to-view-id>
        </navigation-case>
    </navigation-rule>
public String login() {
    // ...
    return "correct";
}
public String login() {
    // ...
    return "backend/index";
}