There\'s a small problem with my servlets/jsp web application. I\'m trying to use jstl in jsp page. When I use any tag for example:
Yes, i have doctype in web.xml
Remove that from
web.xml
and make sure that the
is declared conform Servlet 2.4 or newer and all should be well. A valid Servlet 3.0 (Tomcat 7, JBoss AS 6/7, GlassFish 3, etc) compatible web.xml
look like below in its entirety, without any :
For Servlet 3.1 (Tomcat 8, WildFly 8/9/10/11, GlassFish/Payara 4, etc) it look like below:
For Servlet 4.0 (Tomcat 9, WildFly 12, GlassFish/Payara 5, etc) it look like below:
When using JSTL 1.1 or newer, you need to assure that your web.xml
is declared in such way that the webapp runs in at least Servlet 2.4 modus, otherwise EL expressions won't work in the webapp.
When still having a Servlet 2.3 or older or
in web.xml
, even though you already have a Servlet 2.4 or newer XSD, then it would still be forced to run in Servlet 2.3 or older modus, causing the EL expressions to fail.
The technical reason is, EL was originally part of JSTL 1.0 and not available in Servlet 2.3 / JSP 1.2 and older. In JSTL 1.1, EL was removed from JSTL and integrated in JSP 2.0, which goes along with Servlet 2.4. So, if your web.xml
is declared to run the webapp in Servlet 2.3 or older modus, then JSP would expect to find EL in JSTL library, but this would in turn fail if it's a newer JSTL version, lacking EL.