this is actually my first ZK project seems pretty cool but not working and not throwing error either.
If i understand well the concept,server side can respond to interface action without me doing all the ajax plumbing work.I’ve wrote a small login app which does not perform any login per se but on click on submit should display a Messagebox.
here is my index.zul file
<window xmlns:n="native" id="win" apply="com.personal.project.admintest.event.LoginController">
<n:style type="text/css">
button {
color: #999999;
}
#center {
width:500px;
height:100px;
position:absolute;
top:50%; left:50%;
margin:-50px auto auto -100px;
text-align:center;
}
</n:style>
<n:div id="center">
<groupbox id="gbLogin" mold="3d" width="300px">
<caption label="login section" />
<n:table>
<n:tr>
<n:td>
<label value="Username"/>
</n:td>
<n:td>
<textbox value="" id="txtUsername"/>
</n:td>
</n:tr>
<n:tr>
<n:td>
<label value="Password"/>
</n:td>
<n:td>
<textbox value="" id="txtPassword" type="password"/>
</n:td>
</n:tr>
<n:tr style="text-align: center">
<n:td colspan="2">
<button id="btnSubmit" label="Login" width="70px" />
</n:td>
</n:tr>
</n:table>
</groupbox>
</n:div>
</window>
and here is my LoginController file
import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;
public class LoginController extends GenericForwardComposer {
Textbox txtUsername;
Textbox txtPassword;
Window win;
public void onClick$btnSubmit(){
try {
Messagebox.show(txtUsername.getText() + " and pass is " + txtPassword.getText());
} catch(InterruptedException e){
e.printStackTrace();
}
}
}
Unfortunately when i click on the button Nothing Happens at all and there is no error either 🙁 . I’m sure i’m doing something wrong, i just can’t find what it is.
I’would be grateful if somebody can point it out to me.
thanks for reading this.
Apparently the code works.Can’t say what went wrong the first times i’ve run it.
I would like to keep the question here because it might jut help someone get started.
Thanks for all who read it.