I'm trying to learn Servlet but whenever I create one I can't run it. Eclipse returns a 404 error. I read a lot of questions about it here on stackoverflow and on other websites, I've literally tried everything..
I copied the Root, manager etc.. folders on the workplace
I also created a variable in the user section of my computer called HOME_CATALINA
with a value "C:\Program Files\Apache Software Foundation\Tomcat 8.0\libservlet-api.jr;C:\Program Files\Java\jre1.8.0_66\bin;."
and a value in the System Section called CLASSPATH
with a value of "C:\Program Files\Apache Software Foundation\Tomcat 8.0\libservlet-api.jr;C:\Program Files\Java\jre1.8.0_66\bin;."
If I type on the browser "http://localhost:8080" I can see the TomCat webpage. I don't know what to do anymore. I recorded a video so you'll understand: https://www.youtube.com/watch?v=1Y0q6lm7eBU&feature=youtu.be
This is Serv.java:
package pak;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class Serv
*/
@WebServlet("/Serv")
public class Serv extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter prik = response.getWriter();
prik.println("<html><body>Hello World </body></html>");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
This is web.xml: pastebin.com/NfJvz5Vh
What should I do? Help :(