[Resolvido] Problema com jstl

2 respostas
J

Olá,

Estou começando (ou ia começar) a estudar jstl, porém aparece a mensagem:

HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

type Exception report

message The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

description The server encountered an internal error (The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application) that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:410)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
	org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
	org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
	org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
	org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
	org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
	org.apache.jasper.compiler.Parser.parse(Parser.java:138)
	org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
	org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.28 logs.

Apache Tomcat/7.0.28

Meu jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
    <c:forEach var="i" begin="1" end="10" step="1">
      <c:out value="${i}" />
 
      <br />
    </c:forEach>
</body>
</html>

Já importei os jars daqui https://jstl.java.net/download.html, que tem links para aqui:
[list]http://search.maven.org/#browse|707331597[/list]
[list]http://search.maven.org/#browse|-[telefone removido][/list]

Já verifiquei vários posts na net e nada. :x

Desde já agradeço a atenção. :smiley:

2 Respostas

J

Problema resolvido.

Já tinha importado vários outros JARs como driver do mysql no eclipse que é simplesmente adicionar ao “java build path” ou adicionar na pasta “/WEB-INF/lib/”, porém nesse caso precisei adicionar nos 2.

Só por dica, existe os JARs do JSTL no próprio tomcat em “tomcat/webapps/examples/WEB-INF/lib”, não precisa baixar.

Tudo resolvido graças a essa vídeo-aula: [youtube]http://www.youtube.com/watch?v=t_s-I4e3uRY[/youtube].

J

Uma última dica.

Em várias pesquisa na internet percebi que tinha muita gente colocando códigos aleatórios e muitas vezes aparecia algo do tipo “não sei como funciona, só sei que funcionou”.
Como exemplo tempos colocar "http://java.sun.com/jstl/core_rt" no lugar de "http://java.sun.com/jstl/core",
ou "http://java.sun.com/jstl/core" no lugar de "http://java.sun.com/jsp/jstl/core".

Em um artigo que achei (http://stackoverflow.com/tags/jstl/info) tinha algo muito interessante que é justamente explicando isso.
O que acontece é que esses “imports” são para versões diferentes.

Outra coisa que também explica no artigo são os arquivos JARs, pois em alguns sites diz para importar jstl.jar (api) e standard.jar (implementation), em outros jstl e jstl-api, …; porém do mesmo jeito isso são para as diferentes versões, atualmente está na versão 1.2.1 que é justamente da jstl e jstl-api, mas lembrando OS ARQUIVOS DO JSTL ESTÃO NO PRÓPRIO TOMCAT, ou seja, não precisa sair pesquisando na net pra encontrar os JARs.

Criado 29 de abril de 2013
Ultima resposta 29 de abr. de 2013
Respostas 2
Participantes 1