1

我的数据表中有一个复选框和文本框。按下更新按钮后,我需要更新数据库。

请在 test.xhtml 下面查看我的代码

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
<ui:composition template="../templates/layout.xhtml">
  <ui:define name="metadata">
    <f:metadata>
      <f:event type="preRenderView" listener="#{generalServiceBean.init}" />

    </f:metadata>
  </ui:define>
  <ui:define name="content">
    <h:form prependId="false" id="growlForm">
      <p:growl id="growl" showDetail="#{applicationBean.isShowDetailMessage()}" />
    </h:form>
    <h:form prependId="false" id="dataForm">
      <p:panel id="data" toggleable="true" toggleSpeed="250">
        <f:facet name="header">
          <h:outputText value="#{generalServiceBean.title}" />
        </f:facet>
        <h:outputFormat id="noRecordsFound" value="#{messages.label_no_records_found}" rendered="#{!generalServiceBean.dataVisible}">
          <f:param value="GeneralEcs" />
        </h:outputFormat>
        <p:dataTable id="list" value="#{generalServiceBean.allGeneralEcs}" var="generalEc"  editable="true" editMode="cell" rendered="#{generalServiceBean.dataVisible}" resizableColumns="false" paginator="false" paginatorTemplate=" {CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,25,50" rows="10">


         <p:column headerText="Enable"  style="width:13%" >  
              <p:selectBooleanCheckbox  id="chkEnable" />  
        </p:column>  

        <p:column headerText="Description">  


                  <p:inputText id="modelInput" value="#{generalServiceBean.manufacturers}" style="width:96%"/>




        </p:column>  



        </p:dataTable>


                 <h:panelGrid columns="1" cellpadding="5" columnClasses="col1,col2">
                  <p:column >                  
                    <h:outputText value="Check all / Uncheck all " />  
                          <p:selectBooleanCheckbox value="" />  
                  </p:column>

                     <p:column >                  



                      <p:commandButton id="btnUpdate" value="Update" action="#{generalServiceBean.saveBook}" ajax="false"  />

                  </p:column>

            </h:panelGrid>



         <br/>




      </p:panel>
    </h:form>

        </h:form>
      </p:outputPanel>
    </p:confirmDialog>
  </ui:define>
</ui:composition>
</html>

所以我有问题当我按下更新按钮时如何获得数据表的结果?

4

0 回答 0