Hi all , I am trying to map a user to a jsp page when he tries to enter to a directory of my application using URL. let say my web directory is called school and it has a directory called pages . now I need to map a user to error page when he tries to access to pages directory using URL
something like this:
http;//ip_address/school/pages
I have done this in web.xml but it is not working why!!!:

<servlet>
<servlet-name>myjsp</servlet-name>
<jsp-file>/school/errorPage.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>myjsp</servlet-name>
<url-pattern>/school/pages</url-pattern>
</servlet-mapping>

but it is not working ,
please tell me if I am wrong and how I correct it , please if you have another idea please tell me
I need it to apply it in my application
thanks

File errorPage.jsp must be placed inside school folder in the root of your website.

root\
         |
         \school\
                  |
                  | errorPage.jsp

I have done what you have said but still doesn't work although I save configuration after modification of web.xml

I would tell that my server is running on Centons , is it the problem ?
pleasse I need help with this

What is the name of your web application? If it's school, then trying removing /school from the URL pattern. It should work. Also, specify the location of all your resources wrt the web app root i.e. exclude the `school' directory.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.