-1
我的網絡服務器中沒有收到消息。 當我點擊一個按鈕時,我無法獲得小數點的值。ZK錯誤按鈕操作
ZK的行動(的onClick $ kalkulasi)沒有返回任何
這是我的ZK文件
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<zk>
<style>
.silvergray .complex-layout,
.silvergray .complex-layout .z-south,
.silvergray .complex-layout .z-west {
background: #C5E6EF;
}
.breeze .complex-layout,
.breeze .complex-layout .z-south,
.breeze .complex-layout .z-west {
background: #F7F7F7;
}
</style>
<style>
.z-borderlayout {
background: #FFFFFF
}
.complex-layout .z-north {
background: #008BB6;
}
img.complex-layout-header-img {
padding: 0 10px;
}
.complex-layout-header-label {
position: relative;
top: -30px;
padding-left: 40px;
font-size: 24px;
color: White;
font-weight: bold;
}
.inner-border,
.inner-border .z-north,
.inner-border .z-west,
.inner-border .z-south,
.inner-border .z-east {
background: #FFFFFF;
}
.dl-link {
text-decoration: none;
cursor: pointer;
}
</style>
<window id="win" title="Rasio Lancar" width="auto" height="auto" border="" apply="rasiolancar.lancarController">
<borderlayout sclass="complex-layout" height="700px">
<north size="90px" border="0">
<div>
<image sclass="complex-layout-header-img" src="/images/Adempiere.png" />
<label sclass="complex-layout-header-label" value="SCM for Small and Medium Business" />
</div>
</north>
<!-- Sidebar -->
<west width="200px" border="0" flex="true" splittable="true" margins="0,5,0,0">
<vlayout spacing="0">
<panel width="100%" border="normal" title="Menu">
<panelchildren style="padding:5px;">
<vbox>
<toolbarbutton label="Jurnal Keuangan" href="lap_keuangan.zul" image="images/book.png"/>
<toolbarbutton label="Buku Besar " href="neraca.zul" image="images/3.png"/>
<toolbarbutton label="Rasio Lancar" href="rasiolancar.zul" image="images/Modify.png" />
<toolbarbutton label="Rasio Kas" href="rasiokas.zul" image="images/2.png"/>
<toolbarbutton label="Rasio Cepat" href="rasiocepat.zul" image="images/Pie.png"/>
<toolbarbutton label="Rasio Modal Kerja dan Aktiva" href="rasioaktiva.zul" image="images/Bar.png"/>
</vbox>
</panelchildren>
</panel>
</vlayout>
</west>
<!-- Content -->
<center>
<borderlayout sclass="inner-border">
<north border="0" height="4%" margins="2,3,0,0">
<label value="Rasio Lancar" style="font-size:20px;" tooltip="jelas" />
</north>
<center border="2" margins="0,5,5,5">
<window>
<grid>
<rows>
<row>
<div>
<label>Bulan</label>
<combobox id="bulan" >
<comboitem label="Januari"/>
<comboitem label="Februari"/>
<comboitem label="Maret"/>
<comboitem label="April"/>
<comboitem label="Mei"/>
<comboitem label="Juni"/>
<comboitem label="Juli"/>
<comboitem label="Agustus"/>
<comboitem label="September"/>
<comboitem label="Oktober"/>
<comboitem label="November"/>
<comboitem label="Desember"/>
</combobox>
<label>Tahun</label>
<combobox id="tahun" >
<comboitem label="2002"/>
<comboitem label="2003"/>
<comboitem label="2004"/>
<comboitem label="2005"/>
<comboitem label="2006"/>
</combobox>
<button id="kalkulasi1" label="kalkulasi1"/>
</div>
</row>
<row>
<div>
<label>Hasil</label>
<textbox id="hasil1" width="158px" />
</div>
</row>
<row>
<hlayout>
<label value="Perhitungan Manual" style="color:Black;font-size:20px"/>
</hlayout>
</row>
<row>
<div>
<label value="Aktiva Lancar||"/>
<label value="Nilai Utang Lancar || "/>
</div>
</row>
<row>
<div>
<decimalbox id="al" width="150px" />
<decimalbox id="ul" width="150px" />
</div>
</row>
<row>
<div>
<textbox id="hasil2" width="150px" />
</div>
</row>
<row>
<div>
<button id="kalkulasi" label="hitung"/>
<button id="bersihkan" label="Bersihkan"/>
</div>
</row>
</rows>
</grid>
</window>
</center>
</borderlayout>
</center>
<east title="Apa itu Rasio Cepat" size="30%" flex="true" collapsible="true">
<div style="background:#cccccc">
<label value="Rasio ini berguna untuk mengetahui kemampuan suatu UKM dalam melunasi utang jangka pendeknya"
style="color:white;font-size:20px" />
<image src=""/>
</div>
</east>
<south size="40px" border="0" style="background: none repeat scroll 0 0 ;">
<toolbar mold="panel" align="center">
Powered by ZK
</toolbar>
</south>
</borderlayout>
</window>
<popup id="jelas" width="300px">
<html><![CDATA[
Rasio ini berguna untuk mengetahui kemampuan suatu UKM dalam melunasi utang jangka pendeknya
]]>
</html>
</popup>
</zk>
和控制器文件:
package rasiolancar;
import controller.koneksi;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Button;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Decimalbox;
import org.zkoss.zul.Textbox;
/**
*
* @author aulia
*/
public class lancarController extends GenericForwardComposer {
private Combobox bulan = null;
private Combobox tahun = null;
private Textbox hasil1;
private Decimalbox al;
private Decimalbox ul;
private Textbox hasil2 = null;
private koneksi k;
private Connection conn;
public lancarController() throws Exception {
}
public void onClick$kalkulasi1(Event e) throws Exception, SQLException {
System.out.println("testststs");
String bln = null;
String thn = null;
int b = bulan.getSelectedIndex();
if (b == 0) {
bln = "01";
} else if (b == 1) {
bln = "02";
} else if (b == 1) {
bln = "03";
} else if (b == 1) {
bln = "04";
} else if (b == 1) {
bln = "05";
} else if (b == 1) {
bln = "06";
} else if (b == 1) {
bln = "07";
} else if (b == 1) {
bln = "08";
} else if (b == 1) {
bln = "09";
} else if (b == 1) {
bln = "11";
} else if (b == 1) {
bln = "12";
}
int t = tahun.getSelectedIndex();
if (t == 0) {
thn = "2002";
} else if (t == 1) {
thn = "2003";
}
//query ommited
PreparedStatement ps = null;
String sql = "select..from... where bulan='" + bln + "' and tahun='" + thn + "'";
ps = conn.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
Integer hs = new Integer(rs.getString(""));
String h = hs.toString();
hasil1.setText(h);
}
public void onClick$kalkulasi() throws InterruptedException {
System.out.println("test klik1");
try {
BigDecimal aktiva = al.getValue();
BigDecimal utang = ul.getValue();
//ngeprint
System.out.println(aktiva);
System.out.println(utang);
int a = aktiva.intValueExact();
int u = utang.intValueExact();
int hs = (a/u) * 100;
System.out.println("hasil integer" + hs);
Integer h = new Integer(hs);
String hsl = h.toString();
System.out.println("hasil sebelum textbox" + hsl);
hasil2.setText(hsl);
System.out.println("hasil sesudah textbox" + hsl);
} catch (Exception a) {
a.printStackTrace();
}
}
public void onClick$bersihkan(Event e){
al.setText(null);
ul.setText(null);
hasil2.setText(null);
}
}
請幫助我們,我猜ZK文件無法閱讀onClick動作。但我不確定。
感謝幫助我:)
你似乎認爲每個人都知道「ZK」應該是什麼,但事實並非如此。 – Ingo
在發佈問題前嘗試閱讀[this](https://stackoverflow.com/help/mcve) –