Hey, guys. Newbie to tomcat/apache, java returner here.
I'm trying to run th step-by-step example here (http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html).
Unfortunately, I keep getting an error that says "The project was not built since its build path is incomplete. Cannot find the class file for javax.servlet.http.HttpServletResponse. Fix the build path then try building the project." I looked into it and found out that javax.servlet is commented out by default in a conf/web.xml file for tomcat and that this was because people should now shun the use of servlets or something.
My questions, then, are:
Thanks!
Cannot find the class file for javax.servlet.http.HttpServletResponse. Fix the build path then try building the project."
This compilation error means that the JAR file containing the Servlet API is missing in the compile time classpath (the build path). You need to include Tomcat's servlet-api.jar
in the build path as per the comments in the build.xml
file.
I looked into it and found out that javax.servlet is commented out by default in a conf/web.xml file for tomcat and that this was because people should now shun the use of servlets or something.
I am not sure what you're talking about, but you should in fact not touch the conf/web.xml
when still starting with JSP/Servlet development. The default one should be fine. The Servlet API is certainly not discouraged/deprecated or so. It is still the most important core building stone of a Java based webapplication.
That said, it's unclear to me as well what you meant with "How to replace ServletException after Tomcat 6.0" in your question title. Can you elaborate on this in your question as well?