The previous blog wicket practice (I) briefly introduced the concept of Wicket. Today we have completed the first wicket instance-Hello world!
1. Hello World
On the official website of wicket, a hello World instance is provided. The link address is as follows:
Http://wicket.apache.org/learn/examples/helloworld.html
In the official hello World instance, we have roughly done the following:
1) Create the helloworldapplication. Java file. The gethomepage () in this file defines the portal class of the web page.
2) create a helloworld. Java file, which mainly defines the data and content on the web page.
3. Create a helloworld.html file, which is mainly used to layout and locate our data and content.
4) create a web. XML. This file mainly configures a filter to transfer application requests to Org. apache. wicket. protocol. HTTP. wicketfilter class, which is forwarded to the application class defined in the parameter. (In web. XML, in addition to being able to be configured as a filter, it can also be configured as a servlet for distribution. From the implementation effect, there is no essential difference between the two)
2. MAVEN release
On the wicket official website, we also provided a Maven-improved helloworld example. The link address is as follows:
Http://wicket.apache.org/start/quickstart.html
There is no essential difference between the two compared to the original Hello world version. If you know something about Maven, you can easily understand it.
3. Spring release
On the wicket official website, there is a page on the integration of wicket and spring, but unfortunately, this page is not complete yet. However, it is very easy to integrate Spring with our previous two versions. Perform the following steps to complete integration:
1) Abstract The original class of Hello world as each Bean
2) configure the spring configuration file or add spring annotations to the original class.
3) add and configure spring on Web. xml
Related project source code link: https://code.csdn.net/zs15932616453/wicket/tree/master
After the integration of wicket and spring, each component of Wicket becomes the object of spring container management, so that the object-oriented becomes more thorough.
So far, the completed helloworld project is far from meeting our application requirements. It just provides us with an implementation idea. We will continue to conduct in-depth research in the following articles.