Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News

SYS-CON.TV
Cloud Expo & Virtualization 2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
Developing MVC Applications Using ZK and Spring
MVC app with ZK and Spring

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 model is usually an object or a group of objects representing a business entity. In this example, an object called UserProfile is designed to represent a user. It is defined declaratively per EJB 3 standards.

The View:
The zul page, userProfile.zul is a the page that acts as a view that provides information to the user.

The Controller:
ZK provides a convenience feature use Spring beans with minimal code. All spring beans can be accessed by their names as long as a zul page has the following declaration:

<?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>
import com.example.userprofile.controller.UserProfileController;
UserProfileController controller = userProfileController;

</zscript>
Note that ‘userProfileController’ is the name of the Spring bean per its declaration
@Controller("userProfileController")
@Scope("prototype")
public class UserProfileController {

}

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.

About Srinivas Jaini
Srinivas Jaini is a software technologist with extensive experience in developing enterprise software applications.

Latest Cloud Developer Stories
A Tel Aviv start-up called Porticor that’s just hit the radar says it’s got a way to secure the cloud, any cloud. Fancy that, a trustworthy cloud. And Porticor delivers its data encryption solution to IaaS and PaaS users through the cloud in minutes. Fancy that. It’s supposed...
"The volume of data we're generating now from machines pales in comparison to the volume of data we'll soon generate from our own bodies," says data security expert Dave Asprey. Writing in a Trend Micro blog, Asprey - who is one of the leaders in the emerging Quantified Self move...
Rackspace Hosting, the service leader in cloud computing, on Thursday announced its acquisition of SharePoint911, an industry leader in SharePoint consulting, training, and "JumpStart" services within SharePoint. The unification of both companies provides capabilities to deliver ...
Skill at computing comes naturally to those who are adept at abstraction. The best developers can instantly change focus—one moment they are orchestrating high level connections between abstract entities; the next they are sweating through the side effects of each …
Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP)....
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE