Because:
Reason 1 : JSP file error analysis. For example: JSP page error (syntax error or missing dependencies):
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@page session="false" %> <html> <head> <title>Home</title> </head> <body> <h1>Hello world!</h1> <p>The time on server is ${serverTime}.</p> </body> </html>
Do it right:
<%@page session="false" %> <html> <head> <title>Home</title> </head> <body> <h1>Hello world!</h1> <p>The time on server is ${serverTime}.</p> </body> </html>
Reason 2 : lack of dependencies. Fix it by adding these dependencies:
<dependency> <groupId>javax.servlet.jsp.jstl</groupId> <artifactId>jstl-api</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> <scope>provided</scope> </dependency>
You must set the scope as above.
source share