Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home Frameworks ZK Framework
 

ZK-Framework - Creating the Pages

 

ZK-Framework - Creating the Pages

Page 1 of 8

Read from beginning sample Chapter 2 - Online Media Library
ZK-Framework - Online Media Library
Setting up Eclipse to Develop with ZK
Setting up a New Project


Creating the Pages


After the implementation of the model classes (which is not in the scope of this book) it's time to start with implementing the ZUL pages. The first page is index.zul which should be a simple navigation page for the individual pages.



A simple way to execute the individual pages is to offer links for each page on the starting page. In a simple HTML page, we would use a href tag. In a ZUL page the preferred way is to use toolbarbutton. With the following line we add a link to add-media.zul:


    <toolbarbutton label="Add a new media" href="add-media.zul"/>


We need four navigation points, and therefore, four pages to fulfill the requirements of the CRUD feature. These four pages are:


  • Add a new media item: add-media.zul
  • Update an existing media item: update-media.zul
  • Delete an existing media item: delete-media.zul
  • Show media: show-media.zul

The navigation page is depicted in the following figure:



To have a border with a title, the window component of ZK is used. With the help of the div component, the window component is centered. The next problem we have to solve is that each link should appear on a new line. This is achieved by using the br tag from HMTL. Hence, we have to define the XHTML namespace.



The complete implementation of the page is shown below:


Sample Code
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.    <zk xmlns:html="http://www.w3.org/1999/xhtml" target="_blank" rel="nofollow">
  3.  <div align="center">
  4.   <window title="Welcome to the online media library"
  5. border="normal" width="300px">
  6.   <div align="left" style="margin-left:30pt;
  7. margin-top:10pt; margin-bottom:10pt">
  8.  <toolbarbutton label="Add a new media"
  9.     href="add-media.zul"/>
  10.  <html:br />
  11.  <toolbarbutton label="Update a media"
  12.     href="update-media.zul"/>
  13.  <html:br />
  14.  <toolbarbutton label="Delete a media"
  15.     href="delete-media.zul"/>
  16.  <html:br />
  17.  <toolbarbutton label="Show media"
  18.     href="show-media.zul"/>
  19.    </div>
  20.   </window>
  21. </div>
  22. </zk>
Copyright ajaxwith.com



 


Next Page: Menu Page with Result Page


Read Next: ZK-Framework - Online Media Library


 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links