I am working on small web application using jsp, java, mysql and tomcat as web application server. My loginPage.jsp and index.jsp is in WebContent folder and I will collect user information username and password in loginPage.jsp and will use action to call a (loginservlet) servlet class that process (it does other stuff such as validating user and authorising) stuff and execute a line of code as show below
RequestDispatcher dispatcher = request.getRequestDispatcher("index.jsp");
dispatcher.forward(request, response);
Things are ok until I see a 404 error after I entered username and password and hit submit button. It seems there is some confusion around servlet mapping or issue with where I keep my classes in project. right now i kept my servlet classes under /JavaResources/src/com.mycompany.xyz -- in xyz I have my class LoginServlet. Please help me with the issue on why I am getting 404 error.
<welcome-file-list>
<welcome-file>loginPage.jsp</welcome-file></welcome-file-list> <servlet>
<servlet-name>login</servlet-name><servlet-class>com.mycompany.xyz.LoginServlet</servlet-class> </servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-patt ern>/LoginServletPath</url-pattern>
</servlet-mapping>
After entering username and password and hit submit I see 404 page with below information. Instead of showing index.jsp I am getting 404 error, and I am not sure why.
type Status report
message /LoginServletPath
description The requested resource is not available.