|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Hibernate | JSF | Spring Developing MVC Applications Using ZK and Spring
MVC app with ZK and Spring
By: Srinivas Jaini
Jul. 1, 2010 03:33 PM
The ZK framework provides a variety of paradigms to develop Web applications. One the one hand it is always nice to have options, but on the other this can cause un-intentional paradigm disparities when several developers are using the framework to develop an application without a consistent design. By and far, Model View Controller pattern has been adapted by various Web applications and frameworks (like Apache Struts, Apache Beehive PageFlows) to develop quality Web applications. The following is an illustration of how an MVC based Web application can be developed using ZK and Spring. ZK has introduced a lot of features that enable easy integration with Spring. The source code of example application is available for download here. The Model: The View: The Controller: <?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?> With this declaration, any Spring bean can be accessed by its name. For example, the following zscript scriptlet accesses a Spring bean UserProfileController using its name. <zscript> </zscript> The annotation ‘Scope’ defines scope and lifecycle of a Spring bean. By default all Spring beans are Singletons. When declared as of type ‘prototype’, Spring generates the bean objects using a factory pattern. So each call made in zscript on page render gets a new object instance, thus making sure that every user gets a new object whose life span is that of the zul page itself. Using Spring MVC framework, further options are available to specify session scoped controllers. Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
|||||||||||||||||||||||||||||||||||||||||||||||||