One important reason is that in a XML document there can be only one root element. And therefore, if we want to have more root elements for example, more than one window then we can use a zk element as root.
Another area of application is the possibility of iterating over components, or conditional evaluation. It's possible to embed Java code directly between the opening and closing zscript tags.
Another way is to use the src attribute of the zscript element. In this attribute, you could specify a URI to a file, which contains the Java code. The zscript element supports conditional evaluation with the help of the if and unless attributes.
The attribute element defines an attribute of the enclosing element. One area of application is event listeners. The attribute element supports conditional evaluation with if and unless , too.
The custom-attributes element is used to define an object in a special scope for example, page scope. The custom-attributes element supports conditional evaluation with if and unless , too. If we talk about UI, we have to talk about the layout of the pages.
There are some elements that help you in the layout of a ZK page. An example for using div and vbox elements is as follows:. We have only one identifier and not two see the section Identification in ZK. Therefore, the id attribute has to be unique for the same desktop.
Raw for constructing any unrecognized XML element. The elements are case insensitive, and have no mold support the attribute is ignored.
One important paradigm in object-oriented programming is Separation of Concerns SoC. For large applications, it's not advisable to do the layout, and the logic together in one page. For such applications, you should follow the programming principle of separation of concerns.
This separation is not only for architecture, but also for better maintenance of your application. This is because if you have your logic directly in Java classes, you can leverage the full power of your IDE, e. The configuration for the ZK framework is separated in two files: web. The following figure shows that there are some mandatory settings, and some optional additional settings. The configuration in web.
The most important place to configure a web application is the web. Without correct settings nothing will work. In the next paragraphs, we will have a detailed look at the settings that are necessary for the ZK framework. First we need the zkLoader servlet, which loads the ZUML pages when the web container receives a request for a page.
This servlet is named org. Since this is the first entry for the ZK framework it is really necessary to load this first. Use the parameter:. This is a mandatory parameter. This is an optional parameter. It specifies the default log level for the org. The second important and mandatory servlet is org. It handles AJAX requests asynchronously. The last mandatory servlet is the ZK Session Cleaner.
It is a listener and it cleans up the memory when a session is closed. The class is org. ZK has a filter servlet, which post-process the output from other servlets processors. The servlet class is org. DHtmlLayoutFilter and has two optional parameters:. The zk. As the above overview has shown, there are many settings, which already have default values. The purpose of the zk. A list of these settings is given in the Appendix A.
The deployment via Ant or any other IDE integrated tools is rather simple. If you wish to optimize the distribution you may omit the libraries you didn't use like dojoz or timeline. This is because of the rapid rate of releases in ZK; sometimes the Maven repositories have a bit of a delay in publishing. The most famous Maven repositories include the ZK framework, i. The structure of the ZK framework in a Maven repository looks like:.
As the illustration shows the ZK framework within the Maven repository has three different groupIDs:. The artifacts zcommon and zweb are common. See the complete part of the POM. In this chapter, we give an introduction into, and behind the ZK framework.
It's a good point to start your own small ZK projects or do some rapid prototyping with ZK. However, if you think about major projects it's wise to know a little bit about what is inside ZK, and how ZK works.
Here, it's not possible to show you the complete ZUML. We just want to pick some points to show you how these important cornerstones are working. However, now we have talked enough about inside ZK. In the following chapter, the main focus will be on using the ZK framework, and get "infected" by the ZK framework.
Since 17 years he is working as a Software Developer and Architect. He has a Master degree in Computer Science. He started programming with Java in the year After that he has earned much experience in building enterprise java systems, especially web applications. He has a deep knowledge of the java platform and the tools and frameworks around Java.
About this book. Publication date: March Publisher Packt. Pages ISBN Chapter 1. Getting Started with ZK. What is ZK? An AJAX-based event-driven engine 2. Note For the examples, we are using version 2. Note The downloaded archive of the demo contains zkdemo. Note Each main element should have an id attribute.
Uncomment it if you want to use richlets. Note One of the first things every Java programmer gets to know from his or her new programming heaven is that there is no need to care about memory, because the JVM Java Virtual Machine does the job for the developer.
Component Framework representation: org. Component A component is a UI object for example: button, textbox, or label. Page Framework representation: org. Page A page contains components. Note: A page can have multiple root components. Desktop Framework representation: org.
Identification in ZK. Loading and Updating a ZK Page. Phase: Page Initial. Note Note: It's not necessary to define an init sequence. Note Why to use an absolute class name in init? InitSample; System. Note Now we will implement doInit and doAfterCompose.
Page; import org. Phase: Component Creation. Note If we use the forEach attribute the steps are done for each element in the collection. Phase: Event Processing. Phase: Rendering. Note It's worth mentioning that requests to the same desktop are processed sequentially, and requests to different desktops are processed in parallel.
Leave this field empty. All Rights Reserved. Toggle navigation. Get A Quote. Kalashree P. Ready to drive online revenue Get In Touch. ECommerce Agency eCommerce Trends in Leave a Reply Cancel reply Your email address will not be published. Enterprise-level Security. Unlike JavaScript-based solutions where business logic may reside on the client side and can easily be inspected and manipulated; with ZK all business logic is stored and executed at the server meaning increased security for Enterprise applications.
Innovative Technology. Innovation is the driving force that differs us from everyone else and motivates us to be better and better each day. We believe open source is the best way to build an open, secure, and trustworthy software that millions can depend on. Meanwhile ZK EE with advanced features and professional support are available for mission critical projects.
Star ZK is a highly productive Java framework for building amazing enterprise web and mobile applications www. Branches Tags. Could not load branches. Could not load tags. Latest commit. Git stats 26, commits. Failed to load latest commit information. Build script using Github Action. Dec 14, Aug 10, May 12, Update Checkstyle to 8.
0コメント