| Lab Notes The exercise summaries are supplemented by detailed Lab Notes. During the Exercises, participants should work from the Lab Notes. |
- Day One - Getting Started
- Day Two - Navigating Pages
- Day Three - Designing Views
- Day Four - Finishing Touches
Day One - Getting Started
We hit the ground running by building, extending, and testing a simple "hello world" application.
1-0 Welcome to the Workshop
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 Exercises
- Each exercise implements a use case from a working example application, the "MailReader". Each exercise builds on the prior exercise, so that we have a complete, functioning application at the end. The initial exercises cover the simplest use cases. Later exercises cover more complicated topics.
1-1 Building Applications
We explore and extend a simple "Hello World" application that demonstrates the basics of web application infrastructure. How are web applications organized? What components does the framework add to the mix?
Presentation
We overview the framework in broad strokes and setup essential software tools, so we can deploy a "Hello" application to extend in the exercise.
- Web Application Infrastructure (WEB-INF)
- document root
- welcome page
- WEB-INF
- web.xml
- lib
- classes
- document root
- WebWork (Action2) Infrastructure
- webwork.properties
- resources.properties
- xwork.xml
- Working from formal Use Cases
Exercise - 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.)
- Import starter web application into IDE
- Run application to verify infrastructure
- Run test to verify infrastructure
- Create action mapping
- Create server pages
- Use JSP tags
- Configure default action
During the exercises, participants should work from the Lab Notes.
1-2 Jumpstarting JUnit
The framework encourages a layered architecture, which implies a layered approach to testing. Now that we have a presentation layer up and running, we can look at interacting with the business layer. A great way to learn how a software component is with unit tests. How can unit tests do interact with the database? How can a test show us how to find an account or add a new account?
Presentation
We explore the industry-standard testing framework, JUnit.
- Proving it works
- Starting from scratch
- Understanding unit test frameworks
- Setting up JUnit
- Testing with JUnit
- Installing JUnit
Exercise - Retain
Story: MailReader profiles and subscriptions are stored for later retrieval.
- Create unit tests for business code
- Learn how to use the business code API
1-3 Capturing Input
Forms play a strong role in most web applications. How does WebWork (Action2) help us harvest data submitted by a form?
Presentation
- HTML Forms
- Dynamic Forms
- Basic Form Tags
- Error Handling
- Bypassing Validation
- Canceling Submits
- Unexpected Errors
- Finding the Database
Exercise - Register
Story: Subscribers can store login credentials and a primary email contact with the system.
- Create input form
- Create Action class
- Utilize a base "Support" class
- Utilize a business facade
- Utilize ActionErrors
Day Two - Navigating Pages
Now that we are up and running, we ask "How do we get there from here?"
2-0 Review: Getting Started
- Infrastructure, infrastructure, infrastructure
- "Hello World"
- Test first
- Input matters
2-1 Validating Input
The framework provides an extensive but easy-to-use system for vetting data submitted by a form.
Presentation
The validator framework provides a uniform approach to server-side and client-side validation.
- Configuring validation
- Required fields
- Range checks
- Expression checks
Exercise - Register extensions
Story: Values submitted by the Register form must be the correct type, and some values are required.
- Utilize the validation framework to confirm input without changing the server page
During the exercises, participants should work from the Lab Notes.
2-2 Test-Driving Web Development
Once we know the business layer is sound, we can test the presentation layer too.
Presentation
We explore and install a popular testing tool called Canoo WebTest.
- Testing MVC
- Testing with WebTest
- Creating a simple test
- Simplifying tests
- Installing Ant and WebTest
Exercise - Menu
Story: Subscribers can select available tasks from a list, including edit Profile and Logout.
- Install new utilities, like Ant and WebTest
- Utilize Cannoo WebTest to verify navigation within the application.
2-3 Mapping Workflows
The action mappings work closely with the result types to guide clients through the application.
Presentation
- Application-based authentification
- SessionAware
- addFieldError
- hasErrors
- Cancel actions
- redirect-action result type
- onclick="form.onsubmit=null"
Exercise - Logout, Login
Story: Subscribers can end an application session, retaining any changes. Subscribers can present their registration credentials to use an account again.
- Implement application-based authentification
- Implement navigation for Cancel buttons
- Add field-based errors
- Adjust application flow based on circumstances
Day Three - Designing Views
We focus on the glitz and glamour of the user interface.
3-0 Review: Navigating Pages
- Trust but verify
- Click-thru tests
- Who, who are you
3-1 Localizing Content
To reach the broadest audience, some applications support more than one language. Even if your application supports one language, the message resources are an effective tool for managing shared phrases throughout the application.
Presentation
We overview the localization features, which are considered a fundamental part of the framework.
- By any other name
- Framework i18n components
- Localizing an application
- Localizing other components
Exercise - Localize
Story: In addition to English, MailReader must support other languages, including Japanese and Russian.
- Localize the MailReader application using a standard Resource Bundle
During the exercises, participants should work from the Lab Notes.
3-2 Displaying Dynamic Content
Creating interactive screens can be the most rewarding and the most frustrating part of web development. Struts Action relies on JSP tags to display application state.
Presentation
We look at the JSP tags generally, and the framework tags specifically.
- Tag: You're it
- Working with tag libraries
- Utilizing JSTL
- Leveraging framework tags
Exercise - Profile
Story: Subscribers can create and edit an account profile.
- Implement retrieving and updating records
- Adjust or extend page flow for new operations
3-3 Polishing the User Interface
Now that we have it working, let's make it pretty!
Presentation
The Data and UI tags range from the mundane to the insane.
- Data Tags
- Control Tags
- Miscellaneous Tags
- UI Tags
- Why bother with UI tags
- UI Tag Overview
- Tags and Preparable
Exercise - Subscribe
Story: Subscribers can maintain a set of email subscriptions for an account.
- Utilize iterator tag to display a dynamic list of entries
- Link to each item on list
Day Four - Finishing Touches
We fill in the blanks of web development by examining the sprockets and gears of framework internals.
4-0 Review: Designing Views
- Think global, act local
- Getting it back
- Making it pretty
4-1 Coding Business Logic
In most applications, the Actions either do the heavy lifting, or know someone who does.
Presentation
We've already seen several Action classes "in action", now lets take a closer look.
- Ready, set, action!
- Developing with Actions
- The standard Actions
- Action extras
Exercise - Browse
Story: Subscribers can create and edit an account profile.
- Utilize a custom Interceptor to enforce authentification
- Secure the entire application by default, and relax authentification only where needed
- Use a global result to forward to the Login action if authentification fails
During the exercises, participants should work from the Lab Notes.
4-2 Composing Page
Most pages are composed of common characteristics that we can code once and share using SiteMesh
Presentation
SiteMesh is a frameworks in its own right, but most applications only need to use the essentials.
- How Does It Work?
- SiteMesh Architecture
- Installing SiteMesh
- SiteMesh Essentials
- Advanced Decorators
Exercise - Theme
Story: MailReader must be maintained over time. A design based on page composition can be easier to update.
- Utilize include tag to reuse a common element through application
- Utilize a CSS reference to use a common theme throughout application
- Utilize SiteMesh to accomplish the same effect, without requiring a change to the original pages
4-3 Reviewing Best Practices
Presentation
- Configuration
- Results
- Input Properties
- Actions
- Server Pages
- Unit Testing
- Security
- Resources
Exercise - Roundtable
Story: Following best practices can help make an application easier to maintain.
- Roundtable discussion of best practices found in the workshop application.
