Compared with other frameworks, wicket is a java web presentation framework that only adds an identifier to the HTML document.
<Span wicket: id = "message"> Message goes here </span>
Download WICKET framework: http://www.apache.org/dyn/closer.cgi/wicket/6.1.1 here
Binaries/05-Oct-2012 :45-
CHANGELOG-6.x 05-Oct-2012 35 K
KEYS 05-Oct-2012 22 K
Apache-wicket-6.1.1.tar.gz 05-Oct-2012 4.3 M
Apache-wicket-6.1.1.tar.gz.asc 05-Oct-2012 195
Apache-wicket-6.1.1.zip 05-Oct-2012 8.0 M
Apache-wicket-6.1.1.zip.asc 05-Oct-2012 195
Binaries directory
Apache-wicket-6.1.1-bin.tar.gz 05-Oct-2012 M
Apache-wicket-6.1.1-bin.tar.gz.asc 05-Oct-2012 195
Apache-wicket-6.1.1-bin.zip 05-Oct-2012 M
Apache-wicket-6.1.1-bin.zip.asc 05-Oct-2012 195
Download:
Apache-wicket-6.1.1-bin.zip 05-Oct-2012 M This is binary JAR package and instance WAR
Apache-wicket-6.1.1.zip 05-Oct-2012 19:33 8.0 M This is source code
This WICKET6 requires the download and installation of JAVA JDK6 JDK6. In addition, use NETBEAN 7.0 Chinese version instead of ECLISPE.
NETBEAN 7-> file-> new project-> java web-> web Application-> next-> select project name, storage address-> next->
The server selects apache tomcat 7.0.11; Java EE version: java ee 6 WEB; Context path:/webapplication2
Install TOMCAT on netbean 7.
In the next step, do not select the application framework. Because the content listed here is not what we want --> done
A new project appears on the left side of NETBEAN, and the project, file, and server title bar appear on the top of the tree directory.
Project directory structure:
Web Page
Meta-inf
Web-inf
Index. jsp
Source package
Library
Configuration File
File directory structure:
Webapplication2
--- Nbproject
--- SRC
------ Conf manifest. MF
------ Java
--- Web
----- Context. xml META-INF
----- WEB-INF beans. xml
----- Index. jsp
-- Build. xml
Focus on the src directory and web directory. nbproject and build. XML are used during netbean compilation. In addition, Beans. XML can be deleted temporarily. Ignore the other two files.
Return to the project structure, select a library, and add the jar of wicket6.1. Right-click and choose add library. A list box is displayed, indicating that the existing library has been installed. Choose --> Create-> retrieve wicket6.
Select the button <add JAR/folder...> and add all the jar files decompressed by wicket. However, you cannot select a folder here!
Wicket jar package: the bin contains most of the jar packages, when no log package needs to be dug out from the instance war and extracted with 7zip, there are 56 packages under wicket-examples \ WEB-INF \ Lib \
Now the environment is basically done!
Right-click the source package in the project directory-> New-> JAVA package-> get a "helloworld" package name OK, and the gray package icon appears.
Then right-click the icon and choose "helloworldapp" from the new Java class name to display helloworldapp. Java
Write the following code:
HelloWorldApplication. java
package HelloWorld;import org.apache.wicket.protocol.http.WebApplication;public class HelloWorldApp extends WebApplication { public HelloWorldApp() { } /** * @see org.apache.wicket.Application#getHomePage() */ @Override public Class getHomePage() { return HelloWorld.class; }}
If the import has an exclamation mark, the library is not added. retrun helloworld does not indicate this class.
Well, let me create another class!
HelloWorld. java
package HelloWorld;import org.apache.wicket.markup.html.WebPage;import org.apache.wicket.markup.html.basic.Label;public class HelloWorld extends WebPage { public HelloWorld() { add(new Label("message", "Hello World!")); }}
OK. Create another HTML file under the same package.
HelloWorld.html
The HTML file that defines our hello World functionality is as follows:
There are no basic java errors here! Create a web. xml file under the WEB-INF in the project directory structure
Right-click and choose new from other options. Category: Web file type: "Standard deployment descriptor (Web. XML )"
Add the following configurations
Web. xml <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"><web-app> <display-name>Wicket Examples</display-name> <filter> <filter-name>HelloWorldApplication</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value>org.apache.wicket.examples.helloworld.HelloWorldApplication</param-value> </init-param> </filter> <filter-mapping> <filter-name>HelloWorldApplication</filter-name> <url-pattern>/*</url-pattern> </filter-mapping></web-app>
Some 1 filters are written here. <filter-name>
2. Filter TypeapplicationClassName
3 path url-pattern
Because our package name and class name are different, we will slightly rewrite the above
<param-name>applicationClassName</param-name> <param-value>org.apache.wicket.examples.helloworld.HelloWorldApplication</param-value>
Change
<param-name>applicationClassName</param-name> <param-value>HelloWorld.HelloWorldApp</param-value>
<filter-name>HelloWorldApplication</filter-name> <url-pattern>/*</url-pattern>
Change
<Filter-Name> helloworldapp </filter-Name> <URL-pattern>/helloworld/helloworld.html </url-pattern> is changed accordingly:
<filter-name>HelloWorldApplication</filter-name>
Modify the index. jsp file
Add the <a href = "helloworld/helloworld.html"> helloworld </a> hyperlink, which matches the path pattern above.
Right-click webapplication3 and choose "clear" and "generate" to start compilation and deployment. Otherwise, click "OK ".
Then let's take a look at the compiled structure of the file directory:
After compilation is successful, we can see that the classes and Lib files under the build directory are added to compile Java into a class, and the wicket library is also included.
F6 run main project
Click the helloworld hyperlink to activate wicket.
Some errors may occur in the process: Web. xml or Tomcat is not stopped.