//new to java /
Build a Web App in Wicket 1. 4
Using NetBeans
COMMUNITY
Combine Wicket and Java EE 6 to build a Web app easily by separating
markup from business logic.
JAVA IN ACTION
RÉGINA TEN
BRUGGENCATE
AND LINDA VAN DER PAL
In this tutorial, we will show you how to build a simple Web
application in Apache Wicket 1. 4
using the NetBeans IDE. Wicket is
a component-based Web application framework that lets you build
enterprise-grade Web applications using Plain Old Java Objects
(POJOs), HTML, Ajax, Spring,
Hibernate, and Maven.
We chose Wicket as our subject
because we love its separation
of markup and logic and the way
you can build components that
you can reuse. We also wanted
to show how it can be combined
with Java EE 6, because Java
EE 6 is gaining more and more
momentum and is quite easy
to learn. And we used NetBeans
because it offers good integration
between the two.
ABOUT US
Watch the Set Up Project movie to see the
steps to create the project.
Setting Up Your Project
The first part of this tutorial is
based on Jeff Schwartz’ blog about
Java EE 6 and Wicket. If our summary is too concise for your purposes, read the series of articles
mentioned in Schwartz’ blog.
Downloading the required software and files. In this section, you
are going to set up your development environment.
1. Download and install the
following software: MySQL,
NetBeans, and the Wicket
plug-in for NetBeans.
2. You will use create_script_
mysql.sql to create the backing
database. Execute this script
in the command line tool by
running the following line:
\.Create_script_mysql.sql.
Creating the project. In this section, you will create the project
and create the default Wicket
application that will be modified
in a later section.
1. In the NetBeans IDE, from the
File menu, select New Project.
2. Select Java Web in the
Categories panel, select Web
Application in the Projects
panel, and click Next.
3. Enter DuchessStore in the
Project Name field, and click
Next.
4. Make sure GlassFish Server 3 is
selected as the server and Java
EE 6 Web is selected as the Java
EE version, and click Next.
5. In the Frameworks panel,
select Wicket. (If Wicket isn’t
available as a framework, the
Wicket plug-in wasn’t installed
correctly.)
6. Enter org.duchess.example
.wicket for Main Package, and
click Finish.
Note: To see these steps in action,
view the Set Up Project movie.
blog
24
ORACLE.COM/JAVAMAGAZINE /////////////////////////////////////////////// MAY/JUNE 2012