Jsf 2 导航不';不要在旋转木马中工作

Jsf 2 导航不';不要在旋转木马中工作,jsf-2,navigation,primefaces,carousel,Jsf 2,Navigation,Primefaces,Carousel,我需要在我的模型中设置一些值,并将页面导航到另一个值,但在按钮单击时不会发生任何事情(页面导航或方法触发)…我的代码在旋转木马外部工作正常,但在旋转木马内部它不工作(无页面导航) 我的导航在这个旋转木马外工作得很好 <h:commandLink action="detail"> <f:setPropertyActionListener value="#{s}" target="#{sh.currentService}" /> <h:comma

我需要在我的模型中设置一些值,并将页面导航到另一个值,但在按钮单击时不会发生任何事情(页面导航或方法触发)…我的代码在旋转木马外部工作正常,但在旋转木马内部它不工作(无页面导航)





我的导航在这个旋转木马外工作得很好

<h:commandLink action="detail">
    <f:setPropertyActionListener value="#{s}" target="#{sh.currentService}" />
    <h:commandButton value="getService" style="float:right;" />
</h:commandLink>


上面的代码可以让我的页面导航,我想触发的方法也可以正常工作

您应该避免在
h:commandButton
内部嵌套
h:commandLink

只需通过以下方式使用
h:commandButton

<h:commandButton value="getService" action="#{yourBean.yourActionMethod}">
  <f:setPropertyActionListener .../>
</h:commandButton>

您应该避免在
h:commandLink
内部嵌套
h:commandButton

只需通过以下方式使用
h:commandButton

<h:commandButton value="getService" action="#{yourBean.yourActionMethod}">
  <f:setPropertyActionListener .../>
</h:commandButton>

尝试将commandButton放在p:列中。我遇到了这个问题,这里帮助了我。

尝试将commandButton放在p:列中。我遇到了这个问题,这里帮助了我。

即使这对我来说也不起作用……当我在carousel外使用这个命令按钮时,它工作正常……您应该检查请求是否从客户端触发(使用浏览器开发工具)以及是否执行了backing bean方法。您还可以尝试完整请求而不是ajax请求(在
p:commandButton
中设置
ajax=“false”
。当命令按钮位于旋转木马中时,不会执行backingbean方法…&我使用的是
h:commandButton
,因此我希望不需要设置
ajax=“false”
…当我的命令按钮在转盘外部时,从客户端触发请求并执行backing bean方法…即使这对我不起作用…当我在转盘外部使用此命令按钮时,其工作正常…您应该检查请求是否从客户端触发(使用浏览器开发工具)如果执行了backingbean方法,您还可以尝试一个完整的请求,而不是ajax请求(在
p:commandButton
中设置
ajax=“false”
。当命令按钮位于旋转木马中时,backingbean方法不会执行…&我使用的是
h:commandButton
,所以我希望不需要设置
ajax=“false”
…当我的命令按钮在转盘外时,将从客户端触发请求并执行备份bean方法。。。
public String yourActionMethod() {
  // do your stuff here
  return "detail";
}