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.*tojakarta.*, 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 withstruts.xml, interceptors, OGNL, validation, i18n, upload, tags, themes and plugins
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.
-
Foundations: the history and where JSP and Struts stand today, a first Maven WAR on Tomcat 11, and the servlet API underneath.
-
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).
-
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). -
Migration and quick reference: What’s Changed & Migration and the Cheat Sheet.
What’s covered
Foundations
-
Introduction & History: CGI to servlets to JSP to Struts, Model 1 and Model 2, the
javaxtojakartabreak 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.xmland WAR packaging -
What’s Changed & Migration:
javaxtojakarta, 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
-
JSP Lifecycle and Translation: translation to a servlet, compilation and the generated
_jspService -
Syntax, Comments & Escaping: elements, template text, comments and the escape conventions
-
Directives: every
pageattribute,includeandtaglib -
Implicit Objects & Scopes: the nine implicit objects,
PageContextand the four scopes -
Scripting Elements (Legacy): declarations, scriptlets and expressions (legacy)
-
Standard Actions & JavaBeans:
jsp:useBean,jsp:include,jsp:forwardand the bean conventions -
Includes, Forwards & Page Composition: building a page from other resources
-
Error Handling:
errorPage,isErrorPageand the container error pages -
Character Encoding: source, response and request encoding
-
JSP Documents (XML Syntax):
.jspx,jsp:rootand the XML view -
Configuration and Property Groups:
jsp-configand everyjsp-property-groupelement
Expression Language
-
Expression Language Basics: dollar-brace versus hash-brace, implicit objects and resolvers
-
EL Operators & Type Coercion: every operator, precedence and the coercion rules
-
EL Lambdas, Collections & Streams: lambdas, collection literals and the stream operations
-
EL Static Access, Records & Optional: static members, records and
Optional -
EL Configuration & ELProcessor: switching EL on and off, and the standalone
ELProcessor
JSTL
-
JSTL Core: the five libraries,
c:out,c:set,c:if,c:chooseandc:catch -
JSTL Iteration:
c:forEach,c:forTokensandvarStatus -
JSTL URLs, Imports & Redirects:
c:url,c:param,c:importandc:redirect -
JSTL i18n & Messages: locales, bundles and
fmt:message -
JSTL Formatting: numbers, dates and time zones
-
JSTL Functions: the sixteen
fn:functions -
JSTL SQL & XML (Legacy): the legacy
sql:andx:libraries
Custom tags
-
Custom Tags: SimpleTag:
SimpleTaghandlers -
Custom Tags: Classic Handlers:
Tag,IterationTagandBodyTaghandlers -
Tag Library Descriptors & EL Functions: the TLD and EL functions
-
Tag Files & Layouts:
.tagfiles and page layouts
Building applications
-
MVC with Servlets & JSP: Model 1, Model 2 and a front controller
-
Forms, Validation & Sessions: forms, validation and sessions
-
Spring MVC with JSP: JSP as the view technology of Spring MVC and Spring Boot
-
Security: escaping, access control and hardening
-
Jasper Configuration & Precompilation: Jasper parameters, development and production
-
Testing and Debugging JSP Applications: reading the generated servlet, testing and debugging
Part II: Apache Struts
The overview, the version and end-of-life table and the Maven coordinates are on Apache Struts.
Foundations
-
Architecture & Request Lifecycle: filter, action mapper, action proxy, interceptors, action and result
-
Struts Getting Started: the Bookshelf (Struts) application by hand
-
Configuration: struts.xml & Constants:
struts.xml, the configuration files and the constants -
Packages and Namespaces: packages, namespaces and inheritance
-
Actions: action mappings, POJO actions and
ActionSupport -
Wildcard Mappings & Method Invocation: wildcards, regular expressions and strict method invocation
-
Results & Result Types: result types and the global results
-
Exception Handling and Global Results:
exception-mappingand the exception interceptor -
Interceptors: interceptors, stacks and the
defaultStack -
Custom Interceptors: writing your own interceptors
Data, parameters and validation
-
ValueStack, ActionContext & OGNL: the ValueStack, the
ActionContextand OGNL -
Parameter Injection and @StrutsParameter: the
paramsinterceptor and@StrutsParameter -
Type Conversion: converters and conversion errors
-
Validation: validators,
-validation.xmland annotations -
Bean Validation Plugin: Jakarta Bean Validation in Struts
-
Localization and i18n: resource bundles and the locale
-
ModelDriven, Preparable & CRUD:
ModelDriven,Preparableand CRUD -
Action Chaining, Sessions & Scopes: chaining, sessions and scopes
-
File Upload and Download:
actionFileUploadand stream results -
Double-Submit Tokens & Wait Pages: tokens and the execute-and-wait interceptor
Tags and views
-
Tags Overview & Generic Tags: the tag library and the generic tags
-
UI & Form Tags: form and UI tags
-
Themes & Templates: themes and FreeMarker templates
-
FreeMarker & Velocity Views: FreeMarker and Velocity views
-
Tiles & Page Layouts: Tiles and page layouts
Integrations and plugins
-
Convention Plugin & Annotations: zero-configuration actions
-
Spring Integration: the Spring plugin
-
Dependency Injection and CDI: the internal container and CDI
-
JSON Plugin & AJAX: the JSON plugin and AJAX
-
REST Plugin: the REST plugin
-
Other Plugins: the remaining, removed and retired plugins
Quality and operations
-
Testing: testing actions, interceptors and views
-
Debugging, Dev Mode & Logging:
devMode, debugging and logging -
Security Hardening: the hardening checklist
-
Security Headers: CSP, COOP, COEP & Fetch Metadata: browser-side defences
-
Security Bulletins: the S2 security bulletins as a timeline
-
Struts 1 (Classic) & Migration: Struts 1 and the way out of it
-
Deployment & Production: taking a Struts WAR to production
Where related material lives elsewhere on this site
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 |
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, |
Persistence and Bean Validation |
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 |
The comparison table of the introduction lists them next to Struts and Spring MVC. |
Related issues
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
-
Jakarta Pages 4.0 (specification, Javadoc), Pages 3.1 and Pages 4.1
-
Jakarta Standard Tag Library 3.0 (specification, Javadoc, tag documentation) and Tags 3.1
-
Jakarta Expression Language 6.0 (specification) and Expression Language 6.1
-
The Jakarta EE Tutorial (the Jakarta Pages and Jakarta Tags stubs, Expression Language, Servlets, web application basics and internationalization)
-
The Java EE 5 Tutorial (the JSP and JSTL chapters, written for the
javaxera) -
The specification repositories jakartaee/pages, jakartaee/tags and jakartaee/expression-language
Containers
-
Apache Tomcat: Which Version Do I Want?, Jasper How-To (11.0), Migration Guide to 10, the migration tool for Jakarta EE, Host (
legacyAppBase) and the security pages for 9, 10 and 11 -
Eclipse Jetty documentation (the 12.1 operations guide, JSP and JSTL, and the JspC Maven plugin)
-
Eclipse GlassFish, Eclipse WaSP (Jakarta Pages) and Eclipse Expressly (Jakarta Expression Language)
Apache Struts
-
Apache Struts: downloads, releases, end-of-life versions, the announcements of 2023, 2024, 2025 and 2026, the birds-eye view and the primer
-
Getting Started, Core Developers Guide, Tag Developers Guide, Plugins and Security Guide
-
The Struts wiki: Security Bulletins, the version notes and migration guides (Struts 1 to 2, 2.3 to 2.5, 2.5 to 6, 6 to 7)
-
GitHub: apache/struts (including the showcase and the plugins), apache/struts-examples and apache/struts-site
-
Struts 1: the end-of-life announcement and the archived 1.3.10 documentation
Related projects
-
Spring Framework reference, in particular JSP and JSTL, and Spring Boot reference (JSP limitations and template engines)
-
Jakarta Bean Validation, Hibernate Validator, JUnit, HtmlUnit, Playwright for Java and Testcontainers
-
Maven Central for the coordinates and versions
Security sources
-
OWASP Cross Site Scripting Prevention Cheat Sheet, Injection Prevention Cheat Sheet, Java Security Cheat Sheet, Expression Language Injection and OWASP Java Encoder
-
Struts security bulletins (the S2 number links to the bulletin on the Struts wiki, the CVE to its record on cve.org, both checked on 2026-10-08): S2-045 (CVE-2017-5638), S2-057 (CVE-2018-11776), S2-061 (CVE-2020-17530), S2-062 (CVE-2021-31805), S2-066 (CVE-2023-50164), S2-067 (CVE-2024-53677), S2-068 (CVE-2025-64775), S2-069 (CVE-2025-68493), S2-070 (CVE-2026-73631), S2-071 (CVE-2026-73632), S2-072 (CVE-2026-73633), S2-073 (CVE-2026-73634), S2-074 (CVE-2026-73635), S2-075 (CVE-2026-104711), S2-076 (CVE-2026-104712), S2-077 (CVE-2026-104713), S2-078 (CVE-2026-104714) and, for Struts 1, CVE-2014-0114 (Apache Commons BeanUtils as distributed with Struts 1.x)
-
Tomcat security advisories (Tomcat 11 security page): CVE-2024-50379, CVE-2024-56337 (JSP compilation), CVE-2024-52318 (JSP tag recycling), CVE-2025-24813, CVE-2017-12617 and CVE-2020-1938 (AJP)