I know that Tomcat v10.1, refers to the following SPECS :
- Servlet 6.0
- JSP 3.1
- EL 5.0
So my Graddle dependencies are :
dependencies {
compileOnly "jakarta.servlet:jakarta.servlet-api:6.0.0"
compileOnly "jakarta.servlet.jsp:jakarta.servlet.jsp-api:3.1.0"
compileOnly "jakarta.el:jakarta.el-api:5.0.0"
}
I suppose Tomcat already have those libraries, so I use compileOnly.
The problem is that I also need to add corresponding JSTL library, to support old JSP files that includes JSTL tag.
In my JSP files, I fix the correct JSTL tag to :
<%@ taglib prefix="c" uri="jakarta.tags.core" %>
Now regarding the import, I add those depedencies :
implementation 'jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:3.0.0'
The problem is that the jakarta.tags.core is not recognized, I have an exception on it.
Questions :
The JSP spec must be 3.1. Howerver the most recent dependency on Maven is
jstl-api:3.0.0(instead of3.1.0that don't exist). Do that version compliant with JSP spec 3.1 ?How to fix the error ?
In general, Tomcat version 10 does not understand classes in the
javax.*package. For this reason, many applications that havejavaxin their code, and those built for earlier versions of Java EE, which include servlets and JSP, as well as tag libraries such as JSTL, cannot run on the new version of Tomcat 10. Therefore, it is required rewrite the code and replace all references to old libraries, and also update the application version in the descriptor, if available.In Gradle dependencies, you also need to remove all references to
javax. Depending on the dependencies, if the application uses servlet-api or jsp-api, then it must be marked asprovided, because the server already has such libs, although they are loaded by another classloader, so a type conversion error may occur at runtime.As for the JSTL of the new version, you can do the following