I am trying to run a simple web-app with eclipse and tomcat 7. I an index html file with a text input and a submit button that calls on servlet.
I have created a Dynamic web project and have put the html (index.html) file in the WebContent folder.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>title</title>
</head>
<body>
<form action="/TestServ" method="get">
<input type="text" name="input">
<input type="submit" value="Send it!">
</form>
</body>
</html>
I have my package com.testing.web under /Java Rescources/src and in it my servlet (TestServ.java) which looks loke this:
@WebServlet("/TestServ")
public class TestServ extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TestServ() {
super();
// TODO Auto-generated constructor stub
System.out.println("AA%WU^SDJI&^R&KU");
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("AA%WU^SDJI&^R&KU");
}
}
When i select Run->run on server on the project the index.html file loads just fine. The problem is that when i submit the form i get the following error page:
HTTP Status 404 - /TestServ -------------------------------------------------------------------------------- type Status report message /TestServ description The requested resource is not available. -------------------------------------------------------------------------------- Apache Tomcat/7.0.34
I have searched and searched and haven't found a solution that helps me. Most answers around the web point to servlet url mapping mistakes. Note that i have tried many of them to no avail.
Furthermore i would like to add that my server is configured to use jdk1.7.0_10 in the runtime enviroments oprtion.
Finally, i do not understand why eclipse doesn't create the proper class/ structure under WEB-INF when the project is built.
I am totally buffled and any help will be much appreciated. Thank you very much in advance!