package com.chenhailong;
import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;
/**
* @author dnc
*
*/
public class NavomaticApplication extends WebApplication {
public NavomaticApplication() {
}
public Class<? extends Page> getHomePage() {
return Page1.class;
}
}
这部分是添加Border的
package com.chenhailong;
import org.apache.wicket.markup.html.border.Border;
import org.apache.wicket.markup.html.border.BoxBorder;
/**
* Border component.
*
* @author Jonathan Locke
*/
public class NavomaticBorder extends Border
{
/**
*
*/
private static final long serialVersionUID = -6423351173280123140L;
/**
* Constructor
*
* @param id
* The id of this component
*/
public NavomaticBorder(final String id)
{
super(id);
addToBorder(new BoxBorder("navigationBorder"));
addToBorder(new BoxBorder("bodyBorder"));
}
}
这部分是Page1
package com.chenhailong;
import org.apache.wicket.markup.html.WebPage;
/**
*
* @author dnc
*
*/
public class Page1 extends WebPage {
/**
*
*/
private static final long serialVersionUID = -9074590581491134925L;
public Page1() {
add(new NavomaticBorder("navomaticBorder"));
}
}
这部分是Page2
package com.chenhailong;
import org.apache.wicket.markup.html.WebPage;
/**
*
* @author dnc
*
*/
public class Page2 extends WebPage {
/**
*
*/
private static final long serialVersionUID = -5860215264527824313L;
public Page2() {
add(new NavomaticBorder("navomaticBorder"));
}
}
这部分是Page3
package com.chenhailong;
import org.apache.wicket.markup.html.WebPage;
/**
*
* @author dnc
*
*/
public class Page3 extends WebPage {
/**
*
*/
private static final long serialVersionUID = -8240473175664633261L;
public Page3() {
add(new NavomaticBorder("navomaticBorder"));
}
}
<html xmlns:wicket="http://wicket.apache.org">
<head>
<title>Wicket Examples</title>
</head>
<body>
<wicket:border>
<p>
<table height="100%">
<tr>
<td height="100%" valign="top">
<div wicket:id="navigationBorder"><b>Navigation Links</b>
<p><wicket:link>
<a href="Page1.html">Page1</a>
<br />
<a href="Page2.html">Page2</a>
<br />
<a href="Page3.html">Page3</a>
</wicket:link></p>
</div>
</td>
<td valign="top"><span wicket:id="bodyBorder"> <wicket:body />
</span></td>
</tr>
</table>
</p>
</wicket:border>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-31j">
<title>Insert title here</title>
</head>
<body>
<div wicket:id="navomaticBorder"><b>This is test for the
wicket.
</b>
<pre>
public class Page1 extends WebPage {
public Page1() {
add(new NavomaticBorder("navomaticBorder"));
}
}
</pre>
<wicket:link>
<a href="Page2.html">Page2</a>
</wicket:link>
<font color="Yellow">It is the code of Page1.java</font></div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-31j">
<title>Insert title here</title>
</head>
<body>
<div wicket:id="navomaticBorder">
<b>This is test for the wicket.</b>
<pre>
public class Page2 extends WebPage {
public Page2() {
add(new NavomaticBorder("navomaticBorder"));
}
</pre>
<wicket:link>
<a href="Page3.html">Page3</a>
</wicket:link>
<font color="Blue">It is the code of Page2.java</font>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-31j">
<title>Insert title here</title>
</head>
<body>
<div wicket:id="navomaticBorder">
<b>This is test for the wicket.</b>
<p>
<pre>
public class Page3 extends WebPage {
public Page3() {
add(new NavomaticBorder("navomaticBorder"));
}
}
</pre>
</p>
<wicket:link>
<a href="Page1.html">Page1</a>
</wicket:link>
<font color="Red">It is the code of Page3.java</font>
</div>
</body>
</html>
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>
<servlet>
<servlet-name>NavomaticApplication</servlet-name>
<servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>com.chenhailong.NavomaticApplication</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>NavomaticApplication</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
</web-app>