获取数据表PrimeFaces的复选框和文本框值

时间:2013-05-26 19:06:42

标签: jsf checkbox primefaces textbox datatable

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

请参阅下面的代码 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>

所以当我按下“更新”按钮时,我有什么问题可以得到数据表的结果?

0 个答案:

没有答案