How to Deploy ZK Applications to Jelastic Cloud

| January 4, 2013 | DevOps PaaS | , , , , , , , , , , , , , ,

ZK is a highly productive open source Java web framework for building amazing enterprise web and mobile applications. Its unique Server+client Fusion architecture enables developers to write applications using pure Java, design UI in XML while having optional control to the client side. ZK’s true event-driven model reflects desktop programming shielding developers from JavaScript programming, cross-browser issues, complex Ajax communication and the danger of exposing business logic.

ZK affords developers the ability to write one application and make it provide an optimal user experience on any kind of device from the desktop to tablets and smartphones without the need for a separate component set. This technique uses responsive design and responsive components to make creating applications as easy and intuitive as possible.

zk10

ZK is trusted and established with a solid track record as the framework of choice across industries. Tens of thousands of developers use ZK to build their mission critical systems including multi-million dollar systems that serve millions of users and tens of thousands of concurrent sessions on an international scale.

With over 1,500,000 downloads, ZK empowers a wide variety of companies and institutions, ranging from small to large in multiple industries.

As any Java application and framework, ZK is very easy to deploy to Jelastic! Here's how:

Create an environment

1. Go to Jelastic.com and sign up if you haven't done it yet or log in with your Jelastic credentials by clicking the Sign In link on the page.

2. While in Jelastic dashboard, click the Create environment button:

3. In the Environment Topology dialog, pick your application server (for example, Tomcat 7). Then type your environment name, for example, zktest.

zk1

It will take just a minute for your environment to be created.

zk2

Upload Java package

1. Navigate to zkoss.org and download ZK framework free open source community edition.

zk3

zk4

2. Create your application using ZK framework as you usually do. All the necessary libraries you can find in dist/lib folder of the package you have just downloaded. In our case we use simple "Hello world" application (zweb.jar, zul.jar, zkplus.jar, zkbind.jar, zk.jar, zhtml.jar, zel.jar and zcommon.jar are included and located under zk-bin-x.x.x.x/dist/lib).

3. Upload your .war package to the Deployment manager.

zk5

5. Once the package is in Jelastic, deploy it to the environment you have just created.

zk6

6. Now you can open your app in a web browser. You'll see the result of the next code execution:

[code language="xml"]
<window title="My First Window" border="normal" width="200px">
Hello, World!
</window>
[/code]

zk7

7. Building UI with ZK is easy; simply combine and mix match from the hundreds of components readily at hand. For example, in our case we can put the appropriate corrections to index.zul file to get simple registration form without creation of the new war package and redeployment.

[code language="xml"]
<window border="normal" width="400px" style="padding-top:20px;padding-left:20px;" title="Welcome! New User">
<grid hflex="1">
<auxhead>
<auxheader colspan="2" label="Registration Form" style="font-size:16px"/>
</auxhead>
<columns/>
<rows>
<row>
User Name <textbox id="nameBox" hflex="1" constraint="no empty"/>
</row>
<row>
Gender:
<radiogroup id="genderRadio">
<radio label="Male" value="male" checked="true"/>
<radio label="Female" value="female"/>
</radiogroup>
</row>
<row >
Birthday <datebox id="birthdayBox" hflex="1" constraint="no empty, no today, no future"/>
</row>
<row spans="2" align="center" >
<hlayout>
<checkbox id="acceptTermBox"/> Accept Term of Use
</hlayout>
</row>
<row spans="2" align="right">
<hlayout>
<button id="resetButton" label="Reset" />
<button id="submitButton" label="Submit" disabled="true"/>
</hlayout>
</row>
</rows>
</grid>
</window>
[/code]

zk8

Let's check!

zk9

That's all for today, but we continue to post examples on how Jelastic supports your favorite Java applications out of the box with no code changes required. And if you feel like there is still something missing - please do not hesitate to let us know in the comments below.