0

我有一个命令按钮,我绑定了它的操作方法。

<f:view >
    <pm:page title="Title">
        <pm:view id="viewId" swatch="c">
            <p:outputPanel id="panelId">
                <h:form id="formId">   

    <p:commandButton action="#{bean.actionMethod}" update="formId" value="Click" />
                           </h:form>
                     </p:outputPanel>
               </pm:view>
    </pm:page >
</f:view>

内部动作方法。导航指向同一页面。一些值在 action 方法中更新。

public String applyPeriod(String caller)
{
    .....
    retrun SAMEPAGE;
}

一切都好。但未呈现样式。页面返回默认样式。

知道如何加载样式。我不想通过真正的刷新来更改 URL。我应该通过 ajax 调用来管理它。

我跟踪页面的请求。完全不需要样式。

我使用primefaces,primefaces mobile,它是一个移动页面。

4

2 回答 2

2

如果您没有:在表单的 ID 后面使用,我相信问题可能与相对组件搜索有关,试图根据相对标识符查找表单。通过使用不同元素的 ID,您将获得预期的行为,我强调,因为它们以相对于您的上下文的方式正确引用<p:commandButton/>

尝试使用update="@form"update=":formId"。另外,作为旁注,如果您想使用完整的 ajax 并且您不会将用户重定向到任何地方,您的方法应该是void或者 return null

于 2013-03-26T15:57:10.700 回答
0

我真的不知道幕后的原因。但是,我通过提供确切的组件 id 来更新 commandButton 的属性解决了这个问题。

<p:commandButton action="#{bean.actionMethod}" update="ListOfComponentIds" value="Click" />
于 2013-03-26T08:58:03.730 回答