Jsf 导航规则未触发
我有一个如下所示的导航规则:Jsf 导航规则未触发,jsf,navigation,primefaces,Jsf,Navigation,Primefaces,我有一个如下所示的导航规则: <navigation-rule> <display-name>forgotPwd</display-name> <from-view-id>/login/forgotpwd.jsf</from-view-id> <navigation-case> <from-outcome>pass</from-outcome>
<navigation-rule>
<display-name>forgotPwd</display-name>
<from-view-id>/login/forgotpwd.jsf</from-view-id>
<navigation-case>
<from-outcome>pass</from-outcome>
<to-view-id>/login/pwdresetcomplete.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>fail</from-outcome>
<to-view-id>/login/forgotpwd.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
(将uuid作为查询字符串参数传递,并将调用registration.resetPassword函数。)
以下是registration.resetPassword java代码:
(为了简洁起见,省略了细节)
问题:当它返回“通过”时,导航规则没有触发。它返回到/login/forgotpwd.jsf,而不是/login/pwdresetcomplete.jsf
这是因为它附加了UUID参数吗?为什么我的导航没有发射
是否有一些log4j日志,我可以触发,看看为什么这是不工作的 我添加了这两条规则。。。现在它起作用了。不确定是哪一个做的,但使用“从动作”让它更快乐
<navigation-rule>
<display-name>forgotPwd</display-name>
<from-view-id>/login/forgotpwd.xhtml</from-view-id>
<navigation-case>
<from-action>#{registration.resetPassword}</from-action>
<from-outcome>pass</from-outcome>
<to-view-id>/login/pwdresetcomplete.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{registration.resetPassword}</from-action>
<from-outcome>fail</from-outcome>
<to-view-id>/login/forgotpwd.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>forgotPwd</display-name>
<from-view-id>/login/forgotpwd.jsf</from-view-id>
<navigation-case>
<from-action>#{registration.resetPassword}</from-action>
<from-outcome>pass</from-outcome>
<to-view-id>/login/pwdresetcomplete.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{registration.resetPassword}</from-action>
<from-outcome>fail</from-outcome>
<to-view-id>/login/forgotpwd.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
放弃
/登录/forgotpwd.xhtml
#{注册.重置密码}
通过
/登录/pwdresetcomplete.xhtml
#{注册.重置密码}
失败
/登录/forgotpwd.xhtml
放弃
/登录/forgotpwd.jsf
#{注册.重置密码}
通过
/登录/pwdresetcomplete.xhtml
#{注册.重置密码}
失败
/登录/forgotpwd.xhtml
我添加了这两条规则。。。现在它起作用了。不确定是哪一个做的,但使用“从动作”让它更快乐
<navigation-rule>
<display-name>forgotPwd</display-name>
<from-view-id>/login/forgotpwd.xhtml</from-view-id>
<navigation-case>
<from-action>#{registration.resetPassword}</from-action>
<from-outcome>pass</from-outcome>
<to-view-id>/login/pwdresetcomplete.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{registration.resetPassword}</from-action>
<from-outcome>fail</from-outcome>
<to-view-id>/login/forgotpwd.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>forgotPwd</display-name>
<from-view-id>/login/forgotpwd.jsf</from-view-id>
<navigation-case>
<from-action>#{registration.resetPassword}</from-action>
<from-outcome>pass</from-outcome>
<to-view-id>/login/pwdresetcomplete.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{registration.resetPassword}</from-action>
<from-outcome>fail</from-outcome>
<to-view-id>/login/forgotpwd.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
放弃
/登录/forgotpwd.xhtml
#{注册.重置密码}
通过
/登录/pwdresetcomplete.xhtml
#{注册.重置密码}
失败
/登录/forgotpwd.xhtml
放弃
/登录/forgotpwd.jsf
#{注册.重置密码}
通过
/登录/pwdresetcomplete.xhtml
#{注册.重置密码}
失败
/登录/forgotpwd.xhtml
顺便说一句,请求参数在视图中由
{param}
提供。与#{facesContext.externalContext.requestParameterMap}
相比,这样可以保存一些字符
<f:param name="uuid" value="#{param.uuid}" />
这样你就可以摆脱整个
。另见
顺便说一句,请求参数在视图中由
{param}
提供。与#{facesContext.externalContext.requestParameterMap}
相比,这样可以保存一些字符
<f:param name="uuid" value="#{param.uuid}" />
这样你就可以摆脱整个
。另请参见。我一直在想他们是否已经弄明白了这一点。是的,我在JSF2.0上。太棒了,谢谢!我一直在想他们是否已经弄明白了。是的,我在JSF2.0上。太棒了,谢谢!
<from-view-id>/login/forgotpwd.xhtml</from-view-id>
<f:param name="uuid" value="#{param.uuid}" />
public String resetPassword() {
// If good
return "pwdresetcomplete";
// If bad
return "forgotpwd"
}