I made a simple web project. For ease of use, I used a maven jetty plugin and I made several attempts to use the jstl library. In principle, the plugin has a built-in jstl library, and indeed, although I have not explicitly included jstl-1.2.jar, my pages are compiled. The problem occurs when I try to use the functionality of jstl. Example jsp:
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
<h2>Hello World!</h2>
<c:set var = "salary" scope = "session" value = "${2000*2}"/>
<c:out value = "${salary}"/>
</body>
</html>
Preview:
I tried this approaches:
1)to include the library as a dependancy in my pom.xml -> the same result
2)to include the library in WEB-INF.lib -> the same result
3)to include jstl-1.2.jar as external jar in dependencies -> the same result
I am using NetBeans 8.2
There is no need to include jstl library when you use maven jetty plugin. The problem was in Servlet descriptor which can be configured from web.xml. This web.xml solve my problem:
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app>