小编leo*_*173的帖子

如何避免重复单击表单中的按钮?

我的代码:

<h:form id="newBSTypePanel" >
    <h:panelGrid columns="2" id="newRecod" >
        <h:outputText value="Name"/><h:inputText value="#{treeTableController.newBStypeBean.currentObject.TYPENAME.value}" required="true" />
        <p:commandButton value="save" action="#{treeTableController.saveNewNodes}" oncomplete="Dlg.hide()" update="productDataForm"/>
        <p:commandButton value="close" oncomplete="Dlg.hide()" />
    </h:panelGrid>
</h:form>
Run Code Online (Sandbox Code Playgroud)

保存操作有很多相关的功能.如果我反复单击该按钮,它可能会在数据库中保存一些记录.那不是我的愿望.如何防止多次点击并解决此问题?

jsf primefaces

18
推荐指数
2
解决办法
2万
查看次数

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

环境: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)

layout jsf commandlink primefaces

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

jsf ×2

primefaces ×2

commandlink ×1

layout ×1