I have created a dynamic web project in eclipse called testWarNotMaven. I have created an index.html file in the web content folder with the following code
<!DOCTYPE html>
<html lang="en">
<head>
<title>File Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h2>Add Questions</h2>
<form method="POST" action="/upload" enctype="multipart/form-data" >
File:
<input type="file" name="file" id="file" /> <br/>
<input type="submit" value="Upload" name="upload" id="upload" />
</form>
</body>
</html>
I then created a servlet class that begins with the following
@WebServlet("/upload")
@MultipartConfig
public class UploadServlet extends HttpServlet {
When i deployed this project by deploying the EAR project to the server, the index.html page loaded. However when i clicked on the upload button to take me to the servlet class there is
HTTP Status 404 error. The requested resource is not available.
1) I have researched this issue and have come across that the servlet class should be compiled and in the WEB-INF/classes folder. I only have the .java files in the Java Resources/src/. I have no classes folder and no .class files. Why is that and do i need them?
2) When i run the project on the server i am directed to http://localhost:8080/testWarNotMaven/ and when i click the form upload button i am directed to http://localhost:8080/upload. I think i am missing understanding in how the context - root works. I understand that the URL is http://localhost:8080//. Why is the context root missing when the upload button is pressed?
3)Or why else is it that the servlet is not being reached?
EDIT: