JSP & Struts

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

The reference material consulted while preparing these pages is listed in the section bibliography.

This section is written against Jakarta Pages 4.0, Jakarta Expression Language 6.0, Jakarta Standard Tag Library 3.0 (API 3.0.2, implementation 3.0.1) and Jakarta Servlet 6.1, running on Apache Tomcat 11.0.26 and Java 21, and against Apache Struts 7.4.0 (released 2026-10-02), with Spring Framework 7.0.9 and Spring Boot 4.1.1 where Spring is involved. The versions were verified on 2026-10-08, and the examples were built into WARs and run on Tomcat 11.0.26 with curl. Where the four books this section consulted, or older tutorials, describe different behaviour, the pages say so, and What’s Changed & Migration collects every difference in one place.

What JSP, EL, JSTL and Struts are

Jakarta Pages (JSP, JavaServer Pages) turns a text document with embedded dynamic elements into a servlet: the container translates the page once, compiles it, and runs the generated class for every request. Jakarta Expression Language (EL) is the small language inside ${...} and #{...} that reads beans, request parameters and scoped attributes. The Jakarta Standard Tag Library (JSTL, officially Jakarta Tags) is the tag set that replaces scriptlets: conditionals, loops, URLs, formatting, internationalization and string functions. All three run on Jakarta Servlet, the request and response API of the container.

Apache Struts is an action-based MVC framework on top of them. A single servlet filter maps each request to an action class, runs a stack of interceptors around it (parameter binding, validation, file upload, security), and picks a result, usually a JSP, FreeMarker or Velocity view. Struts 7 is the current line; Struts 1 ("Struts Classic") is a different framework and is covered only to read legacy code and to leave it.

This section is for developers who:

  • maintain existing JSP and Struts applications and need an accurate, current reference for them

  • modernise those applications, from javax.* to jakarta.*, from Struts 2.x to 7, or towards Spring MVC with Thymeleaf

  • want to understand the roots of the Java web stack: servlets, the translation of a page, the Model 1 and Model 2 patterns

Version baseline and support status

  • Jakarta Pages 4.0, Expression Language 6.0, Servlet 6.1 and Tags 3.0 are specifications of Jakarta EE 11 and of its Web Profile. The Jakarta EE Tutorial states that Pages "has been archived in favor of Facelets", so Pages and Tags receive maintenance rather than features; the plans for Jakarta EE 12 list Pages 4.1, Tags 3.1, Expression Language 6.1 and Servlet 6.2 (in progress, not released). This section teaches them fully on the current versions.

  • Apache Tomcat 11.0.26 is the reference container. Jetty 12.1.14 and GlassFish 8.0.5 are shown as alternatives. There is no Tomcat 12 yet.

  • Apache Struts 7.4.0 is the current line, built for Java 17 and Servlet 6 and later; 6.12.0 is still maintained. Struts 2.5 (end of life on 2023-10-30), 2.3 (2019-09-12) and 1.x (2013-04-05) are end of life.

  • Spring and Java: Java 21 for the examples (17 is the minimum for Pages 4.0, Expression Language 6.0 and Struts 7), Spring Framework 7.0.9 and Spring Boot 4.1.1. Spring Boot documents that JSPs are not supported in an executable jar and that they should be avoided if possible, so the Spring pages use a WAR.

The Bookshelf scenario

Every example builds one small original application, Bookshelf, in the same domain as the Thymeleaf, Django and PHP and Laravel sections, so that the stacks can be compared page by page. Here it exists twice, as two WARs on Tomcat 11 that share the domain, a service and a repository:

  • bookshelf-jsp (Part I): a front controller servlet, request attributes, JSP views with EL and JSTL, custom tags, forms, validation, sessions and security

  • bookshelf-struts (Part II): the same catalogue as Struts actions with struts.xml, interceptors, OGNL, validation, i18n, upload, tags, themes and plugins

Diagram of the two Bookshelf applications on Tomcat 11. The browser sends requests either to a front servlet in bookshelf-jsp or to the Struts filter in bookshelf-struts. Both call the same service and repository, which read and write the data store, and then forward to a JSP view under WEB-INF that renders the HTML response back to the browser.
Figure 1. The two Bookshelf applications: a servlet or the Struts filter in front of a shared service and repository, and a JSP view that renders the response

The project layout of bookshelf-jsp is assembled in Getting Started, and bookshelf-struts in Struts Getting Started.

Reading path

Read the pages in the order of the outline the first time, then use them as a reference. Before starting, be comfortable with the Java Reference for the language and its build tooling.

  1. Foundations: the history and where JSP and Struts stand today, a first Maven WAR on Tomcat 11, and the servlet API underneath.

  2. Part I, JSP, EL and JSTL: the page lifecycle, syntax and directives, implicit objects, the Expression Language, the tag library, custom tags, and then forms, Spring MVC, Jasper configuration, security and testing (start at JSP, EL & JSTL).

  3. Part II, Apache Struts: architecture and the request lifecycle, struts.xml, actions, results, interceptors, OGNL, parameters and validation, tags and views, plugins, and then security, operations and Struts 1 (start at Apache Struts).

  4. Migration and quick reference: What’s Changed & Migration and the Cheat Sheet.

mindmap root((JSP and Struts)) Foundations History and Model 2 Getting started Servlet fundamentals JSP EL and JSTL Lifecycle and syntax Directives and scopes Expression Language JSTL libraries Custom tags Forms and Spring MVC Jasper and security Apache Struts Request lifecycle struts.xml and actions Results and interceptors OGNL and ValueStack Validation and i18n Tags themes and views Plugins Security and operations Migration javax to jakarta Struts 1 to 7 Cheat sheet

What’s covered

Foundations

  • Introduction & History: CGI to servlets to JSP to Struts, Model 1 and Model 2, the javax to jakarta break and when to choose JSP and Struts today

  • Getting Started: JDK 21, Tomcat 11, Jetty and GlassFish, a Maven WAR, the first servlet, JSP and JSTL page

  • Servlet Fundamentals: lifecycle, requests, scopes, sessions, cookies, filters, listeners, dispatching, web.xml and WAR packaging

  • What’s Changed & Migration: javax to jakarta, every version change of the platform, the errata of the books and the official-documentation inconsistencies

  • JSP & Struts Cheat Sheet: a one-page summary of the whole section with a downloadable PDF

Part I: JSP, EL & JSTL

The overview, the version matrix and the Maven coordinates are on JSP, EL & JSTL.

Core JSP

Expression Language

JSTL

Custom tags

Building applications

Part II: Apache Struts

The overview, the version and end-of-life table and the Maven coordinates are on Apache Struts.

Foundations

Data, parameters and validation

Tags and views

Integrations and plugins

Quality and operations

The pages of this section link to existing material instead of repeating it, and cover only what JSP and Struts add.

Topic Where it lives How this section relates

Thymeleaf, the template engine that replaced JSP in most new Spring applications

Thymeleaf, Introduction & Architecture (Thymeleaf), Spring MVC Integration (Thymeleaf), Forms & Data Binding (Thymeleaf), Expression Utility Objects (Thymeleaf)

The introduction compares JSP with Thymeleaf (natural templates), and the Spring MVC pages point to the Thymeleaf pages for the same controllers with a different view.

Spring Boot, Spring Security, testing, logging and profiles

SpringBoot Reference, Getting Started with Spring Boot, Spring Security, Unit and Integration Testing, Logging, Configuration and Profiles

Spring MVC with JSP and the Spring plugin of Struts link here instead of re-explaining Spring.

The choice between JSP, Thymeleaf, Vaadin and JSF

Server-Side Web UI Frameworks and Vaadin Reference

The introduction compares the Java view technologies and the decision table lives there.

Legacy Struts 1 and JSP monoliths and their migration

Migration Path: Legacy to Modern Stack, Migration Overview, Decisions and Migrations

The Struts 1 page and What’s Changed & Migration link the strangler-fig strategy and show the technology itself.

The Java language and tooling

Java Reference, Build and Tooling, Testing, Records and Sealed Classes, Lambdas and Method References, Streams and Collectors, Optional

Maven, JUnit and the Java features that EL 6.0 exposes (records, lambdas, streams, Optional) are linked, not repeated.

Persistence and Bean Validation

Hibernate Reference and Validation with Hibernate Validator

The data layer of the Bookshelf is not re-documented; the Bean Validation pages link here.

CDI and the Jakarta EE programming model

Jakarta EE and CDI (Vaadin) and CDI and the Programming Model (Quarkus)

The Struts dependency-injection page and the introduction link these pages for CDI.

Containers and Kubernetes

Java and Spring Boot Images, Dockerfile Fundamentals, Testcontainers Fundamentals

Getting Started and the deployment page show only the Tomcat and WAR-specific parts of a Tomcat image.

OAuth 2.0 and OpenID Connect login

OAuth Reference, including Choosing an OAuth Flow

Server-rendered pages that sit behind an OAuth login link here for the flows.

Front end, accessibility, CORS and browser testing

HTML & CSS Reference, Web Accessibility, What is CORS?, E2E Testing in Real Browsers

The security, forms and testing pages link here for theory they do not repeat.

Template security in other stacks

Template Security & XSS (Thymeleaf), Security Hardening (ASP.NET Core), Django Security

The JSP security page and Struts security hardening show the same idea (escape on output, validate on input) in these stacks.

Action-based MVC frameworks in other stacks

ASP.NET MVC, PHP and Laravel, Django

The comparison table of the introduction lists them next to Struts and Spring MVC.

Three related sections are already published: JSF (JavaServer Faces), the official successor of JSP views in Jakarta EE through Facelets; GWT (Google Web Toolkit); and PDF Generation with JasperReports and iText, relevant to the Struts jasperreports result. Other related work is tracked in the repository’s issues and is mentioned here in prose: #258 (Playwright, Cypress and Selenium for end-to-end testing), #263 (a comparison of backend and web development frameworks) and #116 (IDE links).

Bibliography

Every source used for this section is listed here with a link to its official website; each page lists the subset it derives from under its own == References. The documentation of the version you run is authoritative.

Books

The four books were consulted for concept coverage, narrative and structure only. They are linked at the publisher’s official page; no text, listing, figure or sample project of them is reproduced here, and where a book and the current documentation disagree, the documentation of the version you run prevails.

  • Duane K. Fields, Mark A. Kolb and Shawn Bayern, Web Development with JavaServer Pages, 2nd edition, Manning, 2001, ISBN 978-1-930110-12-0 (JSP 1.2): Manning page

  • Shawn Bayern, JSTL in Action, Manning, 2002, ISBN 978-1-930110-52-6 (JSTL 1.0): Manning page

  • Ted N. Husted, Cedric Dumoulin, George Franciscus and David Winterfeldt, Struts in Action, Manning, 2002, ISBN 978-1-930110-50-2 (Struts 1.0 and 1.1): Manning page

  • Donald Brown, Chad Michael Davis and Scott Stanlick, Struts 2 in Action, Manning, 2008, ISBN 978-1-933988-07-8 (Struts 2.0): Manning page

Jakarta EE specifications and tutorials

Containers

Security sources