ZK ‘Client-Server’ Communication Sample Part 2

In the first part (link) we made a javascript embedded into our zul page send data to the controller with the magic zau.send() function. The reverse can be done too, call a javascript on the zul page from the controller.

Lets continue with the sample from part 1:

ZK ‘zau.send()’ Sample

When using the ZK framework out-of-the-box, there is not much need to rely on any other communication methods than using the regular controller methods, except you want to pass client-side data that you can’t catch otherwise, eg. from javascripts. Here the most simple sample to talk from a zul page to a controller and passing data. You find the relevant ZK info/reference here, but I still miss a short and crisp sample.

Requirements:

  • Any Netbeans IDE beyond version 6.0 (with Glassfish or Tomcat installed)
  • ZK plugin to create ZK web app

Continue reading

Get all Browser and Client Info from a ZK session

It is important to capture certain client information, such as browser, locale, ip-address and others as part of logging or auditing. I need to do this in a controller and was curious what I can retrieve from ZK. The information you can find here and there in the ZK docs. Here I summarized all essential objects and methods in one simple app.

ZKSessionInfo Web App

Continue reading

Creating a ZK Groovy Console

SECURITY WARNING: Please take note of the warning at the end of the tutorial !
UPDATE 2011-07-08: A good article on the security concern I recommend http://www.jroller.com/melix/entry/customizing_groovy_compilation_process

We use the Groovy Script Engine to run small Groovy scripts to prepare incoming interface messages for further processing. Here I share with you how to embed the engine into a ZK page. Very basic, though it shows you the concept and it is wasy to expand to your needs.

ZK Groovy Console

Continue reading

ZK with EJB3.1 running on Glassfish (Part 2)

In part 1 we connected a web application to a database using an EJB for reading access, deployed on a Glassfish Server. In part 2 we do some modifications to create a true CRUD application by adding add, delete and update.

Pre-Requirements:

  • Netbeans 6.7 or later
  • Installed ZK plugin (link)
  • Glassfish V3 or later
  • Netbeans Project from Part 1 (link)

Continue reading

ZK with EJB3.1 running on Glassfish

A while back I created a tutorial that covers the direct DB access from a ZK application (link). Today I want to show you the most simple ZK application that reads from a DB using EJB 3.1 and display the data in a listbox.

Prerequisites:

  • Netbeans 6.7 or later
  • Installed ZK plugin (link)
  • Glassfish V3 or later

The tutorial covers 2 steps, the first part to create an EJB and the second part to create a ZK application. It covers all details of the project creation with Netbeans, but it does not elaborate the underlying EJB, JPA technology, feel free to read more about it at the Netbeans doc (eg. link) or in-detail at Oracle (link).

Continue reading

Automatic Version Numbering in Web Applications with Hudson (Part 3)

In this third and last part of the tutorial (part 1, part 2) we add the version reading feature to a ZK application, which is actually not a big difference to the regular jsp page that we created earlier.
It is also a good exercise how to add the ZK library to an existing web project.

Requirements:

  • Netbeans 6.8
  • Glassfish V3 Application Server
  • Installed ZK 5.0 Plugin for Netbeans (link)

(Older Versions and non-EE6 work as well)

Continue reading