diff --git a/java/org/apache/jasper/compiler/JDTCompiler.java b/java/org/apache/jasper/compiler/JDTCompiler.java
index 10c0d10bd42d..7b51b5b58468 100644
--- a/java/org/apache/jasper/compiler/JDTCompiler.java
+++ b/java/org/apache/jasper/compiler/JDTCompiler.java
@@ -324,6 +324,11 @@ public void cleanup() {
// Tomcat. May be supported in a snapshot build.
// This is checked against the actual version below.
settings.put(CompilerOptions.OPTION_Source, "21");
+ } else if (opt.equals("22")) {
+ // Constant not available in latest ECJ version shipped with
+ // Tomcat. May be supported in a snapshot build.
+ // This is checked against the actual version below.
+ settings.put(CompilerOptions.OPTION_Source, "22");
} else {
log.warn(Localizer.getMessage("jsp.warning.unknown.sourceVM", opt));
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_11);
@@ -400,6 +405,12 @@ public void cleanup() {
// This is checked against the actual version below.
settings.put(CompilerOptions.OPTION_TargetPlatform, "21");
settings.put(CompilerOptions.OPTION_Compliance, "21");
+ } else if (opt.equals("22")) {
+ // Constant not available in latest ECJ version shipped with
+ // Tomcat. May be supported in a snapshot build.
+ // This is checked against the actual version below.
+ settings.put(CompilerOptions.OPTION_TargetPlatform, "22");
+ settings.put(CompilerOptions.OPTION_Compliance, "22");
} else {
log.warn(Localizer.getMessage("jsp.warning.unknown.targetVM", opt));
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_11);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b5bfbf2f0bd2..43c1dfa37b6d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -156,6 +156,13 @@
of the Jakarta EL API to align with the latest proposals for the Jakarta
EL 6.0 API. (markt)
+
+ Add support for specifying Java 22 (with the value 22
) as
+ the compiler source and/or compiler target for JSP compilation. If used
+ with an Eclipse JDT compiler version that does not support these values,
+ a warning will be logged and the default will used.
+ (markt)
+