Struts Sample Applications
This lab has a set of sample Struts applications you can play
around. They are provided as "Ready-to-build-and run" NetBeans
project.
Expected duration: 90 minutes
(excluding homework)
Prerequisites
This hands-on lab assumes you have some basic knowledge or
programming experience on the following technologies.
- Servlet and JSP programming
- MVC (Model, View, and Controller) architecture
Software Needed
Before you begin, you need to install the following software on your
computer.
- Java Standard Development Kit (JDK™) version
6.0 (download)
- If you already have installed JDK 5.0 or JDK 6.0, you
can skip this.
- NetBeans IDE 6.1 (download)
- Download either "Web &
Java EE" or "All"
bundles. ("All" is prefered)
- When you install NetBeans IDE, it will ask you which JDK
you want to use.
- 4207_strutsexamples.zip (download)
- The zip file contains this document and the lab contents
- Download it and unzip in a directory of your choice
OS platforms you can use
- Windows
- Solaris x86, Solaris Sparc
- Linux
- Mac OS X
Change Log
- Dec. 20th, 2006: Created
- May 26th, 2007: Document is cleaned up
- Feb. 10th, 2008: Exercise 3 trouble-shooting is added
- July 30th, 2008: NetBeans 6.1 and GlassFish v2 are used for
sample apps
Lab Exercises
Exercise 1: Build and run
"struts-blank" sample application
In this exercise, you are going to build
and run "ready-to-build" Struts sample application.
(1.1)
Open, build, and run "struts-blank" sample application
0. Start NetBeans IDE.
1. Open struts-blank
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/strutsexamples/samples
directory.
- Windows: If you unzipped the 4207_strutsexamples.zip
file under
C:\
directory, the directory to which you want
to browse down should be C:\strutsexamples\samples.
- Solaris/Linux: If you unzipped the 4207_strutsexamples.zip
file under $HOME
directory, the directory to which you want
to browse down should be $HOME/strutsexamples/samples.
- Select struts-blank.
- Click Open Project.
The struts-blank
project node appears under Projects tab
window.
2. Build and run struts-blank project.
- Right-click struts-blank
project and select Run.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "struts-blank" sample
application.
return to the top
Exercise 2: Build and run
"struts-example" sample application
In this exercise, you are going to build
and run "ready-to-build" Struts sample application.
(2.1)
Open, build, and run "struts-example" sample application
0. Start NetBeans IDE.
1. Open struts-example
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/strutsexamples/samples
directory.
- Select struts-example.
- Click Open Project.
The struts-example
project node appears under Projects tab
window.
2. Build and run struts-example project.
- Right-click struts-example
project and select Run.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "struts-example" sample
application.
return to
the top
Exercise 3: Build and run
"struts-bookstore" sample application
In this exercise, you are going to build
and run "ready-to-build" Struts sample application. You will then
build the same application from scratch.
(3.1)
Open, build, and run "struts-bookstore" sample application
0. Start Java DB database server.
1. Open struts-bookstore
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/strutsexamples/samples
directory.
- Select struts-bookstore.
- Click Open Project.
The struts-bookstore
project node appears under Projects tab
window.
2. Build and run struts-bookstore project.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "struts-bookstore" sample
application.
return to
the top
Exercise 4: Build and run
"struts-cookbook" sample application
In this exercise, you are going to build
and run "ready-to-build" Struts sample application. You will then
build the same application from scratch.
(4.1)
Open, build, and run "struts-cookbook" sample application
0. Start NetBeans IDE.
1. Open struts-cookbook
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/strutsexamples/samples
directory.
- Select struts-cookbook.
- Click Open Project.
The struts-cookbook
project node appears under Projects tab
window.
2. Build and run struts-cookbook project.
- Right-click struts-cookbook
project and select Run.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "struts-cookbook" sample
application.
return to
the top
Exercise 5: Build and run
"struts-upload" sample application
In this exercise, you are going to build
and run "ready-to-build" Struts sample application. You will then
build the same application from scratch.
(5.1)
Open, build, and run "struts-upload" sample application
0. Start NetBeans IDE.
1. Open struts-upload
NetBeans project.
- Select File->Open Project (Ctrl+Shift+O). The Open Project dialog box appears.
- Browse down to <LAB_UNZIPPED_DIRECTORY>/strutsexamples/samples
directory.
- Select struts-upload.
- Click Open Project.
The struts-upload
project node appears under Projects tab
window.
2. Build and run struts-upload project.
- Right-click struts-upload
project and select Run.
- Browser gets displayed.
Summary
In this exercise, you have built
and run a ready-to-build-and-run "struts-upload" sample
application.
return to
the top
Homework Exercise (for people
who
are taking Sang Shin's "Java EE Programming online course")
<to
be provided>