Skip to main content

Instructor-led training

Fast Track to Jakarta Struts Training in Pataskala, Ohio

Struts is an open source, Model-View-Controller (MVC) framework developed by The Apache Software Foundation as part of its Jakarta project.

What you'll learn

Struts is an open source, Model-View-Controller (MVC) framework developed by The Apache Software Foundation as part of its Jakarta project. Struts is built on top of JSP, Servlets, and custom tag libraries. After reading the first J2EE Blueprints from Sun with their explanation of MVC and how to accomplish it with custom tags, Servlets, and JSP, one can clearly see that Struts is a manifestation of Sun's J2EE MVC vision. Struts addresses many major issues in using vanilla Servlets/JSP to build web systems. It solves the problem of controller complexity by removing the workflow logic from the Servlets, and directing workflow in an XML configuration file. Struts improves on the limited form support in JSP by adding numerous capabilities to form processing including easy validation, easy error display, and the refilling of form input on form retries from a users previous entries. It minimizes the complexity of JSP pages, by integrating with the JSTL tag library, and additionally supplying a very extensive and flexible set of custom tag libraries for many of the standard operations needed in JSP pages. This course will get you up to speed with Struts in a very short time. It includes all the important concepts, and hands on labs that will have you building working Struts applications in no time flat. In addition, this course covers how to extend the Struts framework to fit your unique needs

Private Training for Teams

This course is offered as private, instructor-led training for organizations, onsite in Pataskala, Ohio or live online. Dates, delivery format, and course content are arranged around your team's requirements.

This course is not currently scheduled as a public class for individual enrollment.

Request Group Training

Prerequisites

Basic knowledge of HTML and JavaScript and practical Java and Servlet/JSP programming experience.

Course Outline

Getting started with Struts  
Jakarta Struts Project
MVC and Struts
Review Servlets, JSP and Web Applications
Struts Architecture
 
Your first Struts Application
Configuring Struts applications
Defining views – the input JSP
Defining ActionForms (FormBeans)
Defining Actions
 
Mapping the Model to the View
Review of Custom Tags
Introduction to JSTL (JSP Standard Template Library)
Using the Struts HTML Tags, Struts Bean Tags and Struts Logic Tags
Pre-populating forms from FormBeans
 
Errors and Debugging Struts Applications
Error Handling
Action Error and ActionErrors
ActionForm validate() method
Error Management in Action.execute()
Error display in JSP pages:  <html:errors> tag
Writing all errors to JSP page
Writing selected errors to JSP page
Handling exceptions
Declarative Exception Handling
Logging – A critical tool
Overview of logging
Simple Servlet Logging
Jakarta Commons Logging
Using Commons Logging
Log Message Levels
Apache log4j
Overview, Loggers, Appenders, Layouts, Using log4j
 
Dynamic Forms and the Validator Framework
Dynamic Forms
Issues with Regular Forms
Overview of Dynamic Forms
Configuring Dynamic Forms - The DynaActionForm and Form Properties
Using the Dynamic Form in the Action
The Validator Framework - Overview
Validation Rules
Adding Errors to the Resource Bundle
Using Validators with Dynamic and Static Forms
Important Predefined Validators : Email, mask, range, length, date and credit card validation
Using the Mask Rule
 
Working with the Tiles Custom Library
Issues with Managing JSP Complexity
View Reuse
The Tiles Framework
Defining Layouts for View Reuse
Using tiles:get, tiles:put, tiles:getAsString and tiles:insert
Tiles Definitions
JSP Definitions – Uses, Shortcomings
Using Definitions
XML Definitions
The Tiles Plugin
Tiles Controllers
 
Additional Capabilities
Forward and Include Actions
Setup Actions
DispatchAction
Managing Complexity
Multiple struts config files
Multiple resource bundles

What makes Struts hard to master

The Java is rarely the obstacle. The difficulty is that Struts moves workflow out of your servlets and into configuration. As the course description puts it, workflow is directed from an XML configuration file. A mistake in a mapping often shows up as a runtime error or a blank page, not a compile error. The syllabus builds the layers in order.

  • Foundation: MVC and Struts, a review of Servlets, JSP and web applications, the Struts architecture, then a first working application. You need the request cycle clear before the framework's indirection makes sense.
  • The core triangle: configuring the application, writing the input JSP, defining ActionForms (FormBeans) and defining Actions. Each piece is wired to the others by name in the configuration file.
  • Views: a review of custom tags, an introduction to JSTL, and the Struts HTML, Bean and Logic tag libraries. Pre-populating forms from FormBeans comes with these.
  • Errors and logging: ActionErrors, the ActionForm validate() method, error handling in Action.execute(), the <html:errors> tag and declarative exception handling. Commons Logging and log4j (loggers, appenders, layouts) are covered as debugging tools.
  • Scaling up: dynamic forms (DynaActionForm) and the Validator framework, Tiles layouts and definitions, then forward/include actions, setup actions, DispatchAction, multiple config files and multiple resource bundles.

A common misconception is that validation belongs only in validate(). The syllabus shows several places errors can originate, and choosing between hand-written and declarative validation is a design decision. Another is that Tiles is only a template trick. Tiles definitions, the plugin and controllers raise real questions about reuse and maintainability.

Who it suits and what to take around it

This three-day introductory course assumes basic HTML and JavaScript and practical Java and Servlet/JSP experience. It suits developers and teams who maintain, support or migrate existing Struts-based web applications. It also suits organizations that need people productive in that codebase quickly. The course material targets Java SE 7 and earlier, which Oracle's lifecycle information lists as out of support. Organizations running other Java versions can ask about customized private training.

If your Servlet/JSP background is thin, Fast Track to Servlets/JSP Using Rational Application Developer (RAD) builds the request/response and JSP skills Struts sits on. Once you can build the controller and view layers, Fast Track to Hibernate 3.x is a natural next step for the persistence side of the model. Teams comparing component-based approaches to web UI might then look at Fast Track to JavaServer Faces 2 (JSF 2). More options are in the Java Programming courses and learning guide.

Illustrative scenarios

The scenarios below are illustrations of how the course material can be applied. They are not descriptions of specific organizations or of the course's lab exercises.

  • Extending a form-heavy intake application. A team might need to add fields to a long registration form. Dynamic forms and the Validator framework (email, mask, range, length, date and credit card rules) let them declare validation and add messages to the resource bundle instead of hand-coding validate() in each ActionForm.
  • Taming duplicated JSP markup. A maintenance group might inherit dozens of pages that each repeat the same header, menu and footer. Tiles layouts and XML definitions, with tiles:insert and tiles:put, centralize that structure so a change is made once.
  • Diagnosing a production fault. A support engineer might need to trace why a request lands on the wrong page. Commons Logging with log4j, plus declarative exception handling, gives a record of the path through the Action and the errors raised along the way.

Using AI coding assistants with Struts

Where they help. AI coding assistants are useful for boilerplate: ActionForm and Action skeletons, log4j appender and layout configuration, a first draft of JSP using the Struts HTML and JSTL tags, and explaining an unfamiliar mapping in an inherited config file.

Where they fail. Struts is configuration-driven and the names must agree across files. Assistants commonly produce a form-bean name in one place and a different one in the action mapping. They may invent tag attributes or validator rule names, or mix in APIs and annotation styles from other frameworks. They also tend to write code that assumes a newer Java than the project uses. Generated validation can look complete while skipping server-side checks, and generated output code may omit escaping.

How to verify.

  1. Cross-check every name in generated code against the Struts config, the validation rules and the resource bundle.
  2. Run the flow, including the failed-validation and exception paths, and confirm errors display and form input is refilled.
  3. Compile and run against the project's actual Java and framework versions.
  4. Raise log levels and read the output to confirm the Action you expect is the one executing.
  5. Review any generated JSP for unescaped user input before accepting it.

Frequently asked questions

What level is this course?

It is introductory to Struts, but it assumes working Java and Servlet/JSP experience. It runs three days and moves from MVC concepts to forms, validation, Tiles and logging.

What should I know before attending?

Basic HTML and JavaScript, plus practical Java and Servlet/JSP programming. The syllabus includes a review of Servlets, JSP and web applications, but it is a refresher, not an introduction.

What does the course cover?

Struts architecture and configuration, ActionForms and Actions, the HTML, Bean and Logic tags with JSTL, error handling, Commons Logging and log4j, dynamic forms and the Validator framework, Tiles, and extras such as DispatchAction and multiple config files and resource bundles.

Can this be delivered privately for our team, onsite or online?

Yes. HSG provides private training for organizations, delivered onsite at your location or live online.

Can the content be customized?

Private course content can be customized, including to the technology versions your organization uses. You can describe your environment in a training proposal request.

Training locations

Fast Track to Jakarta Struts training across the U.S. and beyond.

We provide private Fast Track to Jakarta Struts training for organizations, onsite at your location or live online, throughout the United States and internationally.

View all Fast Track to Jakarta Struts training locations

Train your team with HSG

Private, instructor-led training customized for your organization.

  • Onsite or live online delivery
  • Customized curriculum
  • For a single employee or an entire team
  • Flexible scheduling
  • Experienced instructors
Request Group Training

Questions? Call us at 303.377.6176
or email info@hartmannsoftware.com

Ready to train your team?

Let's customize this training for your organization.

Tell us about your employees, your goals, and your preferred schedule. We'll prepare a training proposal covering scope, delivery format, and pricing.