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 5.0 (download)
- If you already have installed JDK 5.0, you
can skip this.
- The name of the installation file is as following (for JDK 5.0
update x)
- jdk-1_5_0_xx-windows-i586-p.exe (Windows)
- jdk-1_5_0_xx-linux-i586.bin (Linux)
- jdk-1_5_0_xx-solaris-i586.sh (Solaris x86)
- NetBeans IDE 5.5 (download) or
NetBeans IDE 5.0 (download)
- When you install NetBeans IDE, it will ask you which JDK
you want to use. Select the JDK 5.0.
- 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
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 Folder.
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 Project.
- 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 Folder.
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 Project.
- 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 Folder.
The struts-bookstore
project node appears under Projects tab
window.
2. Build and run struts-bookstore project.
- Right-click struts-bookstore
project and select Run Project.
- Browser gets displayed.
Trouble-shooting: If you
experience the following problem, it is highly likely due to the fact
that the Java DB database server is not running. Start the
database server by selecting
Tools from
top-level menu and select
Java DB
Database->Start Server.
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 Folder.
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 Project.
- 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 Folder.
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 Project.
- 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>