zk - what is wrong in my java zkoss program -
updated <?page title="example"?> <window id="music" apply="com.main"> <combobox id="combo" autodrop="true" onchanging="music.suggest()"/> </window> java public class main extends genericcomposer{ /** * */ private static final long serialversionuid = 1l; combobox combo; public void suggest() { combo.getfellow("combo"); combo.getitems().clear(); combo.appenditem("ace"); combo.appenditem("ajax"); combo.appenditem("apple"); combo.appenditem("best"); combo.appenditem("blog"); } }
it says null pointer exception y???
i modified code, can give try :)
zul
<?page title="example"?> <window id="music" apply="com.maincomposer"> <combobox id="combo" autodrop="true"/> </window>
java
public class maincomposer extends genericforwardcomposer{ combobox combo; //zk auto wired , use combo directly public void onchanging$combo() { // zk autoforward (awesome !!) suggest(); } public void suggest() { combo.getitems().clear(); combo.appenditem("ace"); combo.appenditem("ajax"); combo.appenditem("apple"); combo.appenditem("best"); combo.appenditem("blog"); } }
Comments
Post a Comment