Add the WicketFilter with your application class name.
<filter>
<filter-name>helloWorld</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>com.shaan.HelloWorldApplication</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>helloWorld</filter-name> <url-pattern>/*</url-pattern>
</filter-mapping>
Wicket filter handles all the requests.
applicationClassName filter parameter tells which application is available.
url-mapping /* will only process requests that are Wicket requests.
Each Wicket application is defined by an Application object, which
defines the home page and its configuration.
APPLICATION
public class HelloWorldApplication extends WebApplication {
public HelloWorldApplication() {
}
@Override
public Class getHomePage() {
return HelloWorld.class;
}
}
When the base URL of our application is requested, the markup rendered by the HelloWorld page is returned.
HOME PAGE
public class HelloWorld extends WebPage {
public HelloWorld() {
add(new Label("message", "Hello World!"));
}
}
The two parameters are :
1. Component identifier, which Wicket uses to identify the Label component in your HTML markup.
2. Message which the Label should render.
GUI
<html>
<body>
<span wicket:id="message">Message goes here</span>
</body>
</html>
The component declaration consists of :
1. Wicket identifier : wicket:id
2. Component identifier message :
should be the same as the name of the component you defined in your WebPage
.
The text between the <span>
tags is removed when the component renders its message.
The final content of the component is determined by your Java code.
DEPLOY
Deploy the web application into your favorite application server. Point your browser to the URL :
http://<servername>/<warfilename>/
Example
http://localhost:8080/helloworld/
No comments:
Post a Comment
Note: only a member of this blog may post a comment.