如何用prime面'p:commandLink刷新页面的引用部分?

leo*_*173 2 layout jsf commandlink primefaces

环境:Tomcat 6,jsf 2.0,prime faces 2.2.1,chrome explorer

我想单击左侧展开树中的"ViewDetail"链接,并显示产品的详细信息.但是下面的代码不起作用.然后我将属性ajax ="false"添加到链接,似乎工作.但位于页面左侧的"p:treeTable"也会刷新并折叠.那么我该怎么办呢:单击左侧展开的树节点上的链接,在页面的右侧显示信息,并保持左展开的树节点仍然展开.

<h:form id="BizTypeTreeTableForm" >
        <p:layout fullPage="true">
            <p:layoutUnit id="left" position="left" scrollable="true"     width="350" resizable="true" closable="false" collapsible="true" minWidth="250" >
                  <p:treeTable id="BizTypeTreeTable" value="#    {treeTableController.root}" var="treeTable">
                      <p:column>
                              <f:facet name="header">ProductName</f:facet>
                              <h:outputText value="#{treeTable.TYPENAME.value }" />
                          </p:column>
                          <p:column style="width:5%">
                              <f:facet name="header">Action</f:facet>
                              <p:commandLink value="ViewDetail" update="content"      action="#{treeTableController.showDetail}">
                              </p:commandLink>
                      </p:column>
                      </p:treeTable>
            </p:layoutUnit>
            <p:layoutUnit id="center" rendered="true" position="center"    style="text-align:left;" scrollable="true" >
                <h:outputText value="Please click the left tree node" rendered="#    {allTabManager.productObject.TypeNo.value eq null}"/>
            <div id="content" class="ui-widget">
                    <div class="post">
                    <ui:insert name="content_tab" >...</ui:insert>
                </div>
                </div>
            </p:layoutUnit>
         </p:layout>
    </h:form>
Run Code Online (Sandbox Code Playgroud)

Bal*_*usC 6

update必须指向树中的一个真正的JSF组件,而不是一个普通的HTML元素.

更换

<div id="content" class="ui-widget">
Run Code Online (Sandbox Code Playgroud)

通过

<h:panelGroup layout="block" id="content" class="ui-widget">
Run Code Online (Sandbox Code Playgroud)

一个面板组layout="block"将呈现一个<div>而不是一个<span>.