Note that there are some explanatory texts on larger screens.

plurals
  1. POstack overflow servlet tutorial error
    text
    copied!<pre><code> $ java -version java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-10M4406) Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode) </code></pre> <p>Tomcat version: 7.0.40</p> <p>I'm following the beginning servlet/jsp tutorial here:</p> <p><a href="https://stackoverflow.com/tags/servlets/info">https://stackoverflow.com/tags/servlets/info</a></p> <p>and I am getting this error:</p> <blockquote> <p>HTTP Status 500 - The absolute uri: <a href="http://java.sun.com/jsp/jstl/functions" rel="nofollow noreferrer">http://java.sun.com/jsp/jstl/functions</a> cannot be resolved in either web.xml or the jar files deployed with this application</p> </blockquote> <p>Which looks like it's coming from the .jsp file which begins with this line:</p> <pre><code>&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %&gt; &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; </code></pre> <p>I compiled my servlet like this:</p> <pre><code>~/java_programs/modernServlet$ javac -cp /Library/Tomcat/lib/servlet-api.jar -d classes src/com/example/controller/HelloServlet.java </code></pre> <p>And then I copied that file to the same directory structure under WEB-INF classes in the Tomcat directory. Is there some other jar file I should be including in the classpath?</p> <p>==== </p> <p>Okay, I downloaded and copied the jstl jar to Tomcat's lib directory, and and now I get all kinds of compile errors:</p> <pre><code>$ javac -cp "/Library/Tomcat/lib/servlet-api.jar;/Library/Tomcat/lib/jstl-1.2.jar" -d classes src/com/example/controller/HelloServlet.java src/com/example/controller/HelloServlet.java:7: package javax.servlet does not exist import javax.servlet.ServletException; ^ src/com/example/controller/HelloServlet.java:8: package javax.servlet.annotation does not exist import javax.servlet.annotation.WebServlet; ^ src/com/example/controller/HelloServlet.java:9: package javax.servlet.http does not exist import javax.servlet.http.HttpServlet; ^ src/com/example/controller/HelloServlet.java:10: package javax.servlet.http does not exist import javax.servlet.http.HttpServletRequest; ^ src/com/example/controller/HelloServlet.java:11: package javax.servlet.http does not exist import javax.servlet.http.HttpServletResponse; ^ src/com/example/controller/HelloServlet.java:14: cannot find symbol symbol: class HttpServlet public class HelloServlet extends HttpServlet { ^ src/com/example/controller/HelloServlet.java:13: cannot find symbol symbol: class WebServlet @WebServlet("/hello") ^ src/com/example/controller/HelloServlet.java:17: cannot find symbol symbol : class HttpServletRequest location: class com.example.controller.HelloServlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ^ src/com/example/controller/HelloServlet.java:17: cannot find symbol symbol : class HttpServletResponse location: class com.example.controller.HelloServlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ^ src/com/example/controller/HelloServlet.java:17: cannot find symbol symbol : class ServletException location: class com.example.controller.HelloServlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ^ src/com/example/controller/HelloServlet.java:23: cannot find symbol symbol : class HttpServletRequest location: class com.example.controller.HelloServlet protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ^ src/com/example/controller/HelloServlet.java:23: cannot find symbol symbol : class HttpServletResponse location: class com.example.controller.HelloServlet protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ^ src/com/example/controller/HelloServlet.java:23: cannot find symbol symbol : class ServletException location: class com.example.controller.HelloServlet protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ^ src/com/example/controller/HelloServlet.java:16: method does not override or implement a method from a supertype @Override ^ src/com/example/controller/HelloServlet.java:22: method does not override or implement a method from a supertype @Override ^ 15 errors </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload