WICKET FAQ

January 12, 2010

What is WebApplication in wicket? How it helps in initializing an application ?

A web application is a subclass of Application which associates with an instance of WicketServlet to serve pages over the HTTP protocol. This class is intended to be subclassed by framework clients to define a web application. Moreover WebApplication is an Abstract class which must be inherited.

Application settings are given defaults by the WebApplication() constructor and internalInit method, such as error page classes appropriate for HTML. WebApplication subclasses can override these values and/or modify other application settings by overriding the init() method and then by calling getXXXSettings() to retrieve an interface to a mutable Settings object. Do not do this in the constructor itself because the defaults will then override your settings.

If you want to use a filter specific configuration, e.g. using init parameters from the FilterConfig object, you should override the init() method. For example:

public void init() {
String webXMLParameter = getInitParameter(“myWebXMLParameter”);
URL schedulersConfig = getServletContext().getResource(“/WEB-INF/schedulers.xml”);

what is wicket ?

Apache Wicket, commonly referred to as Wicket, is a lightweight component-based web application framework for the Java programming language conceptually similar to JavaServer Faces (JSF) and Tapestry. It was originally written by Jonathan Locke in Spring of 2005. Version 1.0 was released in June 2005. It graduated into an Apache top-level project in June 2007

Traditional MVC frameworks work in terms of whole requests and whole pages. In each request cycle, the incoming request is mapped to a method on a controller object, which then generates the outgoing response in its entirety, usually by pulling data out of a model to populate a view written in specialised template markup. This keeps the application’s flow-of-control simple and clear, but can make code reuse in the controller difficult.

Wicket, on the other hand, is closely patterned after stateful GUI frameworks such as Swing. Wicket applications are trees of components, which use listener delegates to react to HTTP requests against links and forms in the same way that Swing components react to mouse and keystroke events.

Wicket uses plain XHTML for templating (which enforces a clear separation of presentation and business logic and allows templates to be edited with conventional WYSIWYG design tools). Each component is bound to a named element in the XHTML and becomes responsible for rendering that element in the final output. The page is simply the top-level containing component and is paired with exactly one XHTML template. Reuseable parts of pages may be abstracted into components called panels, which can then be pulled whole into pages or other panels with a special tag.

Each component is backed by its own model, which represents the state of the component. The framework does not have knowledge of how components interact with their models, which are treated as opaque objects automatically serialized and persisted between requests. More complex models, however, may be made detachable and provide hooks to arrange their own storage and restoration at the beginning and end of each request cycle. Wicket does not mandate any particular object-persistence or ORM layer, so applications often use some combination of Hibernate objects, EJB beans or POJOs as models.

Updating……..

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.