I'm using Apache Tomcat v8.0 server and in Java EE application. Basically, I created an ResponseUpload servlet. I need to get JSON data from the web app through POST request. Here it is the code of the Servlet:
@WebServlet("/RequestUpload")
public class RequestUpload extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
 * @see HttpServlet#HttpServlet()
 */
public RequestUpload() {
    super();
    // TODO Auto-generated constructor stub
}
/**
 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 */
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    BufferedReader reader = request.getReader();
    Gson gson = new Gson();
    JSONObject json = gson.fromJson(reader, JSONObject.class);
    uplRequest.upload(json);
    PrintWriter out = response.getWriter();
    out.print(json);
}
Then to test if it works I added a form to jsp file, doing POST to url:
The form:
<form action= "RequestUpload" method = "POST">
    First Name: <input type = "text" name = "first_name">
    <br />
    Last Name: <input type = "text" name = "last_name" />
    <input type = "submit" value = "Submit" />
</form>
But I got 404 error -
HTTP Status 404 - /webApp/RequestUpload
Can somebody show me where is my mistake?
My web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>webApp</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>
P.S. Another form doing the same with RPC servlet (which structure is similar) is working.
 
    

 
    