The "Welcome" session includes a brief overview of the course. The workshop for this session is in two parts. The first part installs web development prerequisites. The second workshop covers the Welcome story. Both workshops are instructor-lead, to build momentum.
Welcome to the Course
We introduce the workshop outline and related materials. How will the workshop be presented? What will the workshop accomplish?
About the Presentations
- Each session begins with a general presentation that covers the exercise prerequisites.
About the Workshops
- Each workshop implements a use case from a working example application, the "MailReader". Each exercise builds on the prior workshop, so that we have a complete, functioning application at the end. The initial workshops cover the simplest use cases. Later workshops cover more complicated topics.
Building Applications
We explore and extend a simple "Hello World" work flow that demonstrates the basics of web application infrastructure.
Presentation - Building Struts 2 Applications
How are web applications organized? What components does the framework add to the mix? Can traditional architectures be applied to web applications?
We overview the framework in broad strokes and setup essential software tools, so we can deploy a simple "Hello" application that we extend in the main workshop.
- Web Application Infrastructure
- Struts Framework Components
- Model View Controller Architecture
Prerequisites
- CD source code
- IDE projects and modules
- message resources
- text tag
Preliminary Workshop [with instructor]
- Install Foundation Software
- Java
- Tomcat
- IDE (Eclipse, IDEA, NetBeans)
- Setup Environment
- Create a "MailReader" IDEA project
- Copy the lib directory from the CD or download

- Create a web module for "mailreader"
- Import the "hello" lab from CD
- Test Environment
- Run the JUnit test
- Create a Tomcat Server and run the application
- Confirm that page says "Congratulations. Struts is up and running."
Hint Code
All the code is provided, but let's review the code for rendering text from the message resources:
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=hello">
</head>
<s:text name="hello.message"/>
Accomplishments
- Installed Java, Tomcat, IDE
- Imported starter web application into IDE
- Ran tests and sample application to verify infrastructure
Main Workshop - Welcome [with instructor]
Story: Visitors to the MailReader application can select tasks available to them from the default Welcome menu. (The exercise is done as a group, to be sure that everyone gets off to a good start.)
- Create action mapping
- Create server pages with JSP tags
- Configure default action
Prerequisites
- Hello
- web.xml, package.properties, index.html
- struts.xml, Hello.java, HelloTest.java
- Hello.jsp, taglib, text tag
- Supporting Technologies
- HTML, HTTP, Java, Servlets (hopefully understood)
- JavaBeans, XML configuration, JSP Taglibs (cover for servlet based teams)
- Welcome
- default-action
- url tag
Exercises
- Utilize module created in Preliminary Workshop
- Review Welcome use case
- Create a "Missing" JSP template with the text
- "This feature is under construction. Please try again in the next iteration."
- Create an action mapping for Missing, making it the default
- Create a Welcome page and action to realize the Welcome user case
- Refer to "Missing" in the links
- Update index.html to load "Welcome.action"
- Play-test the page and links
Hint Code
Linking to other resources through Uniform Resource Identifiers (URIs) is a vital part of coding web applications. Struts 2 provides a tag that specializes in rendering URIs.
<a href="<s:url action="Register"/>">Register with MailReader</a>
Aside from action, the uri tag can also link to local and remote pages.
Accomplishments
- Created action mapping
- Created server pages with JSP tags
- Configured default action
