部分渲染数据表

时间:2012-03-20 09:52:44

标签: java jsf jsf-2 primefaces

保存表单的组件后,我将其显示在数据表中。有趣的是,如果我不刷新页面,我的数据表部分呈现值。

这是服务类:

public EBSResponse uyeTeminatKaydet(UyeTeminat uyeTeminat, Kullanici sessionUser, String ipAdresi ){
        Session session = null;
        Transaction tx = null;              
        EBSException EE = new EBSException();
        EBSResponse ER = new EBSResponse();        
        RequestContext context = RequestContext.getCurrentInstance();
        context.addCallbackParam("saved", false);
        Date tarih = new Date();
        if (uyeTeminat.getTarih()!= null) 
            tarih = uyeTeminat.getTarih();
        else
            uyeTeminat.setTarih(tarih);

        uyeTeminat.setDurum(Boolean.TRUE);

        BigDecimal teminatDegeri=null;

        try {
            session = HibernateUtil.getSessionFactory().openSession();
            tx = session.beginTransaction();
            teminatDegeri=calculateTeminatDegeri(uyeTeminat,tarih, session);
            uyeTeminat.setTeminatDegeri(teminatDegeri);   
        session.save(uyeTeminat);
            session.flush();
        tx.commit();
            List<UyeTeminat> uyeTeminatList = getTumUyeTeminatlari(session);
            ER.setStringValue("teminatIslemleriBean.uyeTeminatKaydet.info1");
            ER.setObjectValue(uyeTeminatList);            
            context.addCallbackParam("saved", true);           
        } catch (Exception ex) {
            ex.printStackTrace();
            if (tx != null) {
                tx.rollback();
            }
            EE.setHataTipi(EBSConstants.HATA_TIPI_ERROR);
            EE.setHataMesaji("teminatIslemleriBean.uyeTeminatKaydet.err1");
            ER.setExceptionValue(EE);

        } finally {
            if (session != null && session.isOpen()) {
                session.close();
            }
        }
        return ER;
    }

这是支持bean:

public void uyeTeminatKaydet() {
        EBSResponse er = uyeServisi.uyeTeminatKaydet(uyeTeminat, sessionUser, ipAdresi);
        if (er.getExceptionValue() == null) {
            this.uyeTeminatList = (List<UyeTeminat>) er.getObjectValue();
            FacesUtil.addMessage(FacesMessage.SEVERITY_INFO, LocaleBean.lang.getString(er.getStringValue()));
            uyeTeminat = new UyeTeminat();
        } else {
            FacesUtil.addMessage(EBSUtils.getHataTipi(er.getExceptionValue().getHataTipi()), LocaleBean.lang.getString(er.getExceptionValue().getHataMesaji()));
        }        
    }

screen capture

有没有人对此有任何想法?

编辑: XHTML:

<h:outputText value="#{lang.teminatTuruAdi}: *" />
                            <h:selectOneMenu id="TeminatTuru" required="true" converter="teminatTurConverter" value="#{teminatTanimlamaIslemleriBean.teminat.teminatTur}">
                                <f:selectItem itemLabel="#{lang.seciniz}" />
                                <f:selectItems value="#{teminatTanimlamaIslemleriBean.teminatTurleriMenu}" />
                            </h:selectOneMenu>

                            <h:outputText value="#{lang.teminatKodu}: *" />
                            <p:inputText size="50" maxlength="50" required="true" value="#{teminatTanimlamaIslemleriBean.teminat.teminatKodu}"/>

                            <h:outputText value="#{lang.teminatAdi}: *" />
                            <p:inputText size="50" maxlength="50" required="true" value="#{teminatTanimlamaIslemleriBean.teminat.teminatAdi}"/>

                            <h:outputText value="#{lang.birimFiyat}: *" />
                            <p:inputText id="BirimFiyat" size="30" maxlength="50" value="#{teminatTanimlamaIslemleriBean.teminat.birimFiyati}" 
                                         style="text-align:right" onkeypress="return isNumberAndComma(event); isMaxLength(this, 14, event);" onkeyup="this.value=numberFormat(this.value,6);">
                                 <f:converter converterId="ondalikAltiHaneConverter" />
                            </p:inputText>

                            <h:outputText value="#{lang.fiyatTipi}: *" />
                            <h:selectOneMenu id="FiyatTipi" required="true" value="#{teminatTanimlamaIslemleriBean.teminat.fiyatTuru}">
                                <f:selectItem itemLabel="#{lang.seciniz}" />
                                <f:selectItems value="#{genelBilgiBean.fiyatTipiListesi}" />
                            </h:selectOneMenu>

                        </h:panelGrid>

                    <br/>
                    <p:commandButton value="#{lang.kaydetButton}" onclick="confirmationKaydet.show()"/>
                    <br/><br/>


                <p:dialog showEffect="explode" hideEffect="explode" resizable="false"
                          header="#{lang.uyari}" widgetVar="confirmationKaydet" appendToBody="true" modal="true">
                    <h:outputText value="#{lang.kayitOnayMesaji}"/>
                    <br/><br/>
                    <p:commandButton value="#{lang.evetButton}" actionListener="#{teminatTanimlamaIslemleriBean.teminatKaydet}"
                                     update="sysMsg, dTable"
                                     process="mf:formPanel"
                                     onstart="waitDialog.show(),confirmationKaydet.hide()"
                                     oncomplete="waitDialog.hide();handleComplete(xhr, status, args);" />
                    <p:commandButton value="#{lang.hayirButton}" onclick="confirmationKaydet.hide()" type="button" />
                </p:dialog>              
                </p:panel>               
                <p:panel id="dtPanel" style="width: 80%">
                    <p:dataTable style="width: 100%;" id="dTable" var="tt" value="#{teminatTanimlamaIslemleriBean.teminatList}" paginator="true" rows="20"
                                 selection="#{teminatTanimlamaIslemleriBean.selectedTeminat}" selectionMode="single" emptyMessage="#{lang.kayitBulunamadi}"
                             onRowSelectUpdate="mf:tabcontent" onRowSelectComplete="tvl();">

                    <f:facet name="header">
                        #{lang.menu_teminat}
                    </f:facet>

                        <p:column filterBy="#{tt.teminatId}" sortBy="#{tt.teminatId}">
                            <f:facet name="header">
                                <h:outputText value="#{lang.teminatId}" />
                            </f:facet>
                            <h:outputText value="#{tt.teminatId}" />
                        </p:column>

                        <p:column filterBy="#{tt.teminatTur.teminatTuruAdi}" sortBy="#{tt.teminatTur.teminatTuruAdi}">
                            <f:facet name="header">
                                <h:outputText value="#{lang.teminatTuruAdi}" />
                            </f:facet>
                            <h:outputText value="#{tt.teminatTur.teminatTuruAdi}" />
                        </p:column>

                        <p:column filterBy="#{tt.teminatKodu}" sortBy="#{tt.teminatKodu}">
                            <f:facet name="header">
                                <h:outputText value="#{lang.teminatKodu}" />
                            </f:facet>
                            <h:outputText value="#{tt.teminatKodu}" />
                        </p:column>

                        <p:column filterBy="#{tt.teminatAdi}" sortBy="#{tt.teminatAdi}">
                            <f:facet name="header">
                                <h:outputText value="#{lang.teminatAdi}" />
                            </f:facet>
                            <h:outputText value="#{tt.teminatAdi}" />
                        </p:column>

                        <p:column filterBy="#{tt.birimFiyati}" sortBy="#{tt.birimFiyati}" style="text-align:right">
                            <f:facet name="header">
                                <h:outputText value="#{lang.birimFiyat}" />
                            </f:facet>
                            <h:outputText value="#{tt.birimFiyati}" style="text-align:right">
                                <f:converter converterId="ondalikAltiHaneConverter" />
                            </h:outputText>
                        </p:column>

                        <p:column filterBy="#{tt.fiyatTuru}" sortBy="#{tt.fiyatTuru}">
                            <f:facet name="header">
                                <h:outputText value="#{lang.fiyatTipi}" />
                            </f:facet>
                            <h:outputText value="#{tt.fiyatTuru}" />
                        </p:column>

                        <p:column filterBy="#{tt.durum == true ? lang.kullanimda : lang.kullanimDisi}" sortBy="#{tt.durum == true ? lang.kullanimda : lang.kullanimDisi}">
                            <f:facet name="header">
                                <h:outputText value="#{lang.durum}" />
                            </f:facet>
                            <h:outputText value="#{tt.durum == true ? lang.kullanimda : lang.kullanimDisi}" />
                        </p:column>

                        <f:facet name="footer">
                             #{lang.toplamKayit}: #{fn:length(teminatTanimlamaIslemleriBean.teminatList)}
                        </f:facet>
                    </p:dataTable>
                </p:panel>

1 个答案:

答案 0 :(得分:0)

有两个问题:

  1. Uye和Teminat的相应转换器未包含必要的字段。
  2. 相同字段的正确xhtml应为:
  3. d

    <h:selectOneMenu id="uyeAdi" required="true" converter="uyeConverter" value="#{teminatTanimlamaIslemleriBean.uyeTeminat.uye}">
    <h:selectOneMenu id="teminatTuruAdi" required="true" converter="teminatTurConverter" value="#{teminatTanimlamaIslemleriBean.uyeTeminat.teminat.teminatTur}">