The following is my web.xml mapping which works fine. The real problem happens once I try to add a new servlet mapping or change the values in the existing mapping.
<servlet>
<servlet-name>GetServlet</servlet-name>
<servlet-class>com.servlet.json.JsonServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GetServlet</servlet-name>
<url-pattern>/getData</url-pattern>
</servlet-mapping>
The web.xml which didnt work is:
<servlet>
<servlet-name>GetServlet</servlet-name>
<servlet-class>com.servlet.json.JsonServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>MultiServlet</servlet-name>
<servlet-class>com.servlet.json.ChummaServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GetServlet</servlet-name>
<url-pattern>/getData</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>MultiServlet</servlet-name>
<url-pattern>/multi</url-pattern>
</servlet-mapping>
The jquery code through which I make a servlet call is the following. However when I change the multi to getData in the below code. It works.
function getData(){
$.get("multi", function(data) {
alert(data);
});
}
When I debugged in chrome I find the $.get is not getting called. I double checked the class files location. They are all in the correct folders. Where am I wrong?