Bom dia.
Estou tendo problemas com a implementação do JSTL no meu projeto que, mesmo com as indicações de diversos tópicos no fórum sobre versões que devem ser usadas ( JSTL 1.2 , TomCat 9.0 ) não estou conseguindo prosseguir no curso. De certa forma, os únicos problemas de execução do TomCat são relacionados de alguma forma com o Servlet que faz o Request para o JSP e, consequentemente, o JSP que utilizaria do JSTL. Abaixo, seguem algumas informações referente ao projeto e, desde já, agradeço qualquer ajuda!
OBS: Estou usando o IntelliJ IDEA.
Servlet para listar empresas junto com o Request Dispatcher para o JSP
public class CompaniesListServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
PrintWriter out = resp.getWriter();
DataBase dataBase = new DataBase();
out.println("<html><body>");
for (Company company : dataBase.getRegisteredCompanies()) {
out.println("<p>" + company + "</p>");
}
out.println("</body></html>");
RequestDispatcher rd = req.getRequestDispatcher("listCom.jsp");
req.setAttribute("listCom", dataBase.getRegisteredCompanies());
rd.forward(req, resp);
}
}
JSP para a listagem dos objetos do Request
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Companies in system</title>
</head>
<body>
<ul>
<c:forEach items="${listCom}" var="company">
<li>
${company.name}
</li>
</c:forEach>
</ul>
</body>
</html>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.alura.manager.servlets</groupId>
<artifactId>manager</artifactId>
<version>1.0-SNAPSHOT</version>
<name>manager</name>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<junit.version>5.8.2</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</build>
</project>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<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_4_0.xsd"
version="4.0">
</web-app>
HTTP Status 505