Tutorial: Reading from the DB with Netbeans and ZK
Summary
• Netbeans 6.5 with a running derby DB and the sample database (customer table) Content: 1. – The binary format JDK 6 (if earlier version,before 1.5, you have problems compiling JPA methods or creating entity classes) 2. Remark: You could add the controller code into a tag directly into the zul file, but I wont recommend that for functionality of that extent. Now we need to add (finally) some functionality to the controller and the zul file: – the class needs to extend the Window class (org.zkoss.zul.Window) – a arraylist that the zul file can access via a getter – some persistence code to read all customer records (for the sake of the simple sample we place this in the constructor and we read all records) – import the required packages (Use “Fix Imports”) Give the window an id and connect it to the controller class. Modify the listbox as follows: There we go, run the project, it gets deployed and your favorite browser should open showing this: • This is the most basic possible version, it lacks of any error handling and security.