我正在使用Primefaces 6.0,Netbeans 8.0和Apache Tomcat 8.3。
我在xhtml中的方法之一未触发。 xhtml中有2个数据表和5个diaolog,我正在这些对话框中添加和更新记录。运行程序时,不会触发我的方法之一。调试时,我无法弄清楚错误在哪里,因为我无法进入方法。 Netbeans的输出面板或apache tomcat的日志文件不返回任何错误。
这是对话框
<p:dialog id="yazismainsert" widgetVar="insertyazisma" position="center" style="font-size: 14px!important" header="YAZIŞMA KAYIT">
<p:outputPanel id="yazismainsertpanel">
<p:panelGrid>
<p:row>
<p:column>
<p:outputLabel value="Şikayet No " />
</p:column>
<p:column>
<p:outputLabel value="#{sikayetislem.update_var.id}" />
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel value="İşlem Tarihi" />
</p:column>
<p:column>
<p:inputMask value="#{sikayetislem.insertsikayethareket_var.islemtarihi}" mask="99/99/9999" />
</p:column>
<p:column>
<p:outputLabel value="Termin Tarihi" />
</p:column>
<p:column>
<p:inputMask value="#{sikayetislem.insertsikayethareket_var.termintarihi}" mask="99/99/9999" />
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel value="Yazı Gönderilen Kurum" style="color:red; font-weight: bold;"/>
</p:column>
<p:column colspan="3">
<p:autoComplete forceSelection="true" value="#{sikayetislem.insertsikayethareket_var.yazigonkurum}" label="#{sikayetislem.insertsikayethareket_var.yazigonkurum}" completeMethod="#{sikayetislem.selectKurumlar}" style="width:100%" size="105" minQueryLength="3" maxResults="30"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel value="Açıklama" />
</p:column>
<p:column colspan="3">
<p:inputTextarea rows="5" cols="50" value="#{sikayetislem.insertsikayethareket_var.aciklama}" style="width:100%" />
</p:column>
</p:row>
<p:row >
<p:column colspan="4" style="text-align: center!important" >
<p:commandButton value="Kaydet" icon="fa fa-fw fa-briefcase" actionListener="#{sikayetislem.yazismainsert}" update="mainform:hareket_tanim:hareketler" oncomplete="PF('insertyazisma').hide();" ajax="false"/>
<p:commandButton type="button" value="Çıkış" icon="fa fa-fw fa-briefcase" onclick="PF('insertyazisma').hide()"/>
</p:column>
</p:row>
</p:panelGrid>
</p:outputPanel>
</p:dialog>
这是bean中的方法
public void yazismainsert(){
try {
MysqlConnect con = new MysqlConnect();
String insertsql = "INSERT INTO `bsi`.`sikayethareketleri` (`sikayetid`,`islemtarihi`, `yazigonkurum`, `termintarihi`, `aciklama`) VALUES (?,?,?,?,?)";
PreparedStatement ps = con.connect().prepareStatement(insertsql);
ps.setString(1, String.valueOf(update_var.id));
ps.setString(2, insertsikayethareket_var.islemtarihi);
if (insertsikayethareket_var.yazigonkurum.isEmpty()){ps.setNull(3, java.sql.Types.NVARCHAR);} else {ps.setString(3, insertsikayethareket_var.yazigonkurum);}
ps.setString(4, insertsikayethareket_var.termintarihi);
if (insertsikayethareket_var.aciklama.isEmpty()){ps.setNull(5, java.sql.Types.NVARCHAR);} else {ps.setString(5, insertsikayethareket_var.aciklama);}
ps.execute();
ps.close();
con.disconnect();
} catch (SQLException ex) {
Logger.getLogger(sikayetislem.class.getName()).log(Level.SEVERE, null, ex);
}
mesajlar.KayıtMesaj();
MasterSikayetDatatableGet(0);
detailsikayetDatatableGet();
}