Agenda • What is Wicket? • Capabilities & Features • Concepts & Architecture • Wicket Components • Life Cycle • Models • Demonstration
San Antonio Java User Group
–
Subramanian Murali
Jan’ 2010
Apache Wicket – A Kick Start
What is Wicket? • • • • • •
Open source, light weight web application framework Based on just Java and HTML Component based and is conceptually similar to JSF Designed after GUI frameworks like Swing Stateful Framework Different from traditional frameworks
Tiny Facts: • First released in 2005 • An Apache project from June 2007
San Antonio Java User Group
–
Subramanian Murali
Jan’ 2010
Apache Wicket – A Kick Start Typical MVC Vs Component Based
San Antonio Java User Group
–
Subramanian Murali
Jan’ 2010
Apache Wicket – A Kick Start Wicket Capabilities & Features •
State Management – Hides the fact that Web App development is based on stateless HTTP protocol – Developers concentrate on business problems rather than plumbing code to manage state – Custom type safe sessions
•
Back button support – Serialized versions of pages visited by a user in session store – What is a session store? (Will discuss later)
•
Page Composition and Templating – Templates designed with plain XHTML (significant advantage) – Templates viewable offline in any browser and editable in WYSIWIG tools Contd..
San Antonio Java User Group
–
Subramanian Murali
Jan’ 2010
Apache Wicket – A Kick Start Wicket Capabilities & Features •
Internationalization – Locale aware markup loading – Locale aware user messages through resource bundles
•
Unit Testing – Wicket Tester – A JUnit based extension – Helper classes to simulate page rendering, link clicks, presence of error messages and components etc.. in a page
•
Type conversion between components and underlying models – Provides converters responsible for converting model attributes from native Java to String representations for a web page and vice versa – Easy to create custom converters Contd..
San Antonio Java User Group
–
Subramanian Murali
Jan’ 2010
Apache Wicket – A Kick Start Wicket Capabilities & Features •
Easy AJAX – Easy to enable AJAX in wicket apps without writing a single line of Java Script – Bunch of built in AJAX enabled components – Excellent debugging utility for debugging AJAX calls
•
Integration with other frameworks – Spring, Guice, Hibernate, Seam, Acegi Security – Terracotta – Open source clustering solution
San Antonio Java User Group
–
Subramanian Murali
Jan’ 2010
Apache Wicket – A Kick Start Wicket Architecture & Concepts
Responsible for processing of all requests to a wicket app Uses Request and Response objects (wrappers of Http Servlet Request and Response) Delegates the processing steps to a request cycle processor Handles two kinds of requests: Stateful and Stateless
Binds data with wicket components Hides what data to get and from where to get Many models available
Behavior – –
Plug-ins for components that changes the component’s markup Used to add AJAX functionality and java script events to components
San Antonio Java User Group
–
Subramanian Murali
Jan’ 2010
Apache Wicket – A Kick Start Wicket Components CheckBox WebPage
Component
Label TextField
Panel Form
Button
TextArea
AjaxLink
Link
San Antonio Java User Group
–
Subramanian Murali
Jan’ 2010
Apache Wicket – A Kick Start Wicket Life Cycle • • •
•
Create a Request Cycle Determine Request Target Process Events – Check Required Input – Invoke Conversion – Invoke Validation – Update Model – Invoke Action Listeners Render Response