Wicket practice (2) Hello World

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.