• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Servlet Context Path Issue

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I am developing a web application which has servlets and JSPs.

Here is my folder structure:

Web-Content -> Jsp -> JSP pages
src -> com->servlets-> Java servlet files

Login.jsp which is under Jsp folder will be the welcome file for this application.

so the URL wud I be accessing for login is http://localhost:8080/myapplication

I am calling the "LoginVerifier" servlet upon entering the username and password in login page as below.

<form action="login" method="post">
..
</form>

In logout, I am redirecting to http://localhost:8080/myapplication/jsp/login.jsp.

So here when I click on login button I am getting 404 error since the container expecting myapplication/jsp/login URL pattern which is not there in web.xml as it is defined in web.xml as below:

<servlet-mapping>
<servlet-name>loginservlet</servlet-name>
<url-pattern>login</url-pattern>
</servlet-mapping>

Please help me how it could be resolved.

Your help is much appreciated.
 
Ranch Hand
Posts: 148
Hibernate Tomcat Server Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

set your welcome file as /jsp/login.jsp

set up your url pattern as /jsp/<servlet> for all the servlets.

Hope this helps.

Thanks
 
udhayan kumar
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Vijay Tidake wrote:Hi,

set your welcome file as /jsp/login.jsp

set up your url pattern as /jsp/<servlet> for all the servlets.

Hope this helps.

Thanks



Thanks Vijay. It is working as expected.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic