This is part 3 of a series about Wicket.
Wicket is an enjoyable framework so it fits well in NetBeans IDE.
It’s trivial to create your pages without even a plugin. For setup information you may recall part 1.
Without plugin
Assume the page Hello that of course IS-A WebPage.
package nikos;
import org.apache.wicket.markup.html.WebPage;
public class Hello extends WebPage {
public Hello() {
}
}
To create its associated HTML file right-click on the project → New → HTML…
Provide the same name Hello, select Source Packages as the location and click Browse…
Just select the folder with the package name, here nikos. As a result Hello.html and Hello.class will be deployed in the same directory!
Here’s the simple page.
<html> <body> <h1 wicket:id="label"></h1> </body> </html>
Thus we don’t specify any value for the <h1> element. Instead we provide a wicket:id.
Let’s return to the class for some action.
package nikos;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
public class Hello extends WebPage {
public Hello() {
String value = "Hello from Wicket in NetBeans!";
add(new Label("label", value));
}
}
The value string may be retrieved by the database, by user input on another page, by the invocation of a remote method etc. The important thing is that we have only to maintain pure Java code.
Conclusion
Wicket’s single requirement is that the .html file and the .class file are bundled in the same directory. That’s trivial to accomplish in NetBeans.
Review
Assume a page with the name Hello.
- It consists of an html and a java file with the same name.
- Hello.java has only java code.
- Hello.html has only html markup.
- As for deployment, Hello.html is placed in the same directory with Hello.class.

