As i mentioned in the title i deployed my java web project to tomcat path /Test2
(before it was deployed to tomcat ROOT and all was working perfectly) and all my webServlets stop working.Here's my servlet settings;
@WebServlet(
name = "SessionLab",
urlPatterns = {"/search","/newcontact","/gosearch","/gocontact","/index"},
initParams = {
@WebInitParam(name = "filename", value = "addressBook.txt")
})
and there was this function to find the relevant urlpath and forward the request
if(request.getRequestURI().equals("/search")) {
readAddressbook(request, response);
}
else if(request.getRequestURI().equals("/newcontact")) {
addnewContact(request, response);
}
.........<so on>
Everything stopped working after i deploy them to folder path rather than ROOT of tomcat9. I even changed the web.xml
for url mapping as follows;
<servlet>
<servlet-name>SessionLab</servlet-name>
<servlet-class>test.AddressBookServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SessionLab</servlet-name>
<url-pattern>/Test2/*</url-pattern>
</servlet-mapping>
Still its not working, i getting 404 error. how to fix this?