I have created a class which extends HttpServlet in a package called controller
I created this in this src folder and have the build path output folder set to webapp/WEB-INF/classes
In my web.xml I have
<servlet>
<servlet-name>SearchController</servlet-name>
<servlet-class>controller.SearchController</servlet-class>
</servlet>
I have a JQuery Ajax call:
$.ajax({
url : "SearchController",
data : "q=test",
...
});
So I expect my servlet class to post something like SearchController?q=test
This doesn’t work. Have I specified the wrong servlet-class in web.xml?
Thanks
You need to have entry for servlet-mapping as well in your web.xml
You can give any value in url-pattern node and you can access the servlet with that value