我无法运行apache wicket示例程序

我无法运行apache wicket示例程序,wicket,Wicket,我对java wicket非常陌生。我不明白如何运行这段代码。我的wicket程序遵循以下结构。我的问题是我不能运行这个。我得到一个404错误 这是我获取hello world消息的wicket代码 HelloWorld.html: <html xmlns:wicket> <title>Hello World</title> </head> <body> <span wicket:id="message"

我对java wicket非常陌生。我不明白如何运行这段代码。我的wicket程序遵循以下结构。我的问题是我不能运行这个。我得到一个404错误

这是我获取hello world消息的wicket代码

HelloWorld.html:

<html xmlns:wicket> 
    <title>Hello World</title>
 </head>
 <body>
     <span wicket:id="message" id="message">Message goes here</span>
 </body>
 </html>
 </html>
这个类返回HelloWorld,它将被打印在HelloWorld.html中

HelloWorldApplication.java:

package com.sensiple.wicket;

import org.apache.wicket.protocol.http.WebApplication;

public class HelloWorldApplication extends WebApplication {

//what is the need of this constructor, need of this class in this program
    public HelloWorldApplication() {
    }
我还需要知道getHomePage方法的用途,因为我不知道这里还有一个类的用途,它返回的返回类型是HelloWorld。我几乎无法运行此代码。我使用了很多没有用的资源

    public Class<HelloWorld> getHomePage() {
        System.out.println("initialized!!!!");
        return HelloWorld.class;
    }
}
public类getHomePage(){
System.out.println(“已初始化!!!!”);
返回HelloWorld.class;
}
}

要开始回答您的许多问题:

  • 由于HelloWord.HTML中的HTML格式不正确,您的程序很可能返回404。Wicket要求valis XHTML与之协作

  • getHomePage()的原始签名是
    公共抽象类请尝试使用以下html:

    <!DOCTYPE html>
    <html xmlns:wicket="http://wicket.apache.org">
     <head> 
        <title>Hello World</title>
     </head>
     <body>
         <span wicket:id="message"></span>
     </body>
    </html>
    
    
    你好,世界
    

    应用程序运行时,只需调用
    http://localhost:8080
    (除非您更改了端口),wicket应该将您重定向到HelloWorld页面

    我试图理解您提供的代码,并将其重新格式化为可读状态。请检查所有内容是否与您的代码匹配。如果是:你的HTML是错误的(没有开始标记,2个结束标记…)
    <!DOCTYPE html>
    <html xmlns:wicket="http://wicket.apache.org">
     <head> 
        <title>Hello World</title>
     </head>
     <body>
         <span wicket:id="message"></span>
     </body>
    </html>