我用我的jsf
中的参数调用了一个支持bean方法<p:commandLink value="createUserFromSearch" action="#{userBacking.fromUserSearch(searchUserBacking.userSearchWithOptions)}"/>
SearchUserBacking
public UserSearch getUserSearchWithOptions(){
//create and return UserSearch Object
}
UserBacking
public String fromUserSearch(UserSearch userSearch){
fillViewLabelsFromUserSearch(userSearch);
return "success";
}
导航规则
<navigation-rule>
<display-name>RouteView</display-name>
<from-view-id>/*</from-view-id>
<navigation-case>
<from-action>#{userBacking.fromUserSearch}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/user/userView.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
结果
找不到资源/user/success.xhtml
我调用没有参数的方法的所有导航规则都在起作用。 为什么不这个?
答案 0 :(得分:2)
因为没有人能够回答我这个问题,所以我分两步解决了这个问题:
我从actionListener属性调用setter方法,从action属性调用导航/逻辑方法,如下所示:
<p:commandLink value="createUserFromSearch" action="#{userBacking.showFromUserSearch}" actionListener="#{userBacking.setUserSearch(searchUserBacking.userSearchWithOptions)}"/>
SearchUserBacking
public UserSearch getUserSearchWithOptions(){
//create and return UserSearch Object
}
UserBacking
public String showFromUserSearch(){
if(this.userSearch!=null){
fillViewLabelsFromUserSearch(userSearch);
return "success";
}else{
return "false";
}
}
public void setUserSearch(UserSearch userSearch){
this.userSearch=userSearch;
}
导航规则
<navigation-rule>
<display-name>RouteView</display-name>
<from-view-id>/*</from-view-id>
<navigation-case>
<from-action>#{userBacking.showFromUserSearch}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/user/userView.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
结果
找不到资源/user/success.xhtml
我调用没有参数的方法的所有导航规则都在起作用。 为什么不这个?