Skip to content

Commit

Permalink
Merge pull request #25382 from volosied/23167-jakarta-imports
Browse files Browse the repository at this point in the history
Create Jakarta Constants for JSP/Pages
  • Loading branch information
volosied authored Jan 30, 2025
2 parents 93ac6c3 + b8b8cc9 commit 95e686d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/Constants.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1997, 2023 IBM Corporation and others.
* Copyright (c) 1997, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand All @@ -20,6 +20,14 @@ public class Constants {
"javax.servlet.jsp.*"
};


/* Wildcard is not needed since these are imported via jakarta.el.ImportHandler#importPackage */
public static final String[] JAKARTA_STANDARD_IMPORTS = {
"jakarta.servlet",
"jakarta.servlet.http",
"jakarta.servlet.jsp"
};

public static final String[] STANDARD_JSP_EXTENSIONS = {
"*.jsp",
"*.jspx",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1997, 2024 IBM Corporation and others.
* Copyright (c) 1997, 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -318,9 +318,9 @@ protected void generateClassSection(ValidateJspResult validatorResult) {
// the imports below are required for all pages
writer.println("static {");
// Pages 1.10 Directive Packages java.lang.*, jakarta.servlet.*, jakarta.servlet.jsp.*, and jakarta.servlet.http.* are imported implicitly by the JSP container.
writer.println("importPackageList.add(\"jakarta.servlet\");");
writer.println("importPackageList.add(\"jakarta.servlet.jsp\");");
writer.println("importPackageList.add(\"jakarta.servlet.http\");");
for(String jakartaPackage : Constants.JAKARTA_STANDARD_IMPORTS) {
writer.println("importPackageList.add(\""+ jakartaPackage + "\");");
}
writer.println("}");
}

Expand Down

0 comments on commit 95e686d

Please sign in to comment.