Hello,
I am using the getRequestDispatcher of the ServletRequest and it says that it can take relative path also.
For example for example, we have to find some resource whose location is
/webapp1/html/hello.jsp
So lets say we are requested a resource
http://localhost:8080/webapp1/servlet/ServletA
The way to obtain the RequestDispatcher would be
If we look at the URL requested, it says that ServletA is in directory servlet, so .. will mean go one directory above and then find the requested resource.
In this case /servlet can be a logical directory only, it might not exist also. So far so good.
Now lets say we change the <url-pattern> to something like
<url-pattern>
/servlet/ben/ServletA
</url-pattern>
Now it means that ServletA is existing in directory ben and this time if we give something like
It will say that, the requested resource is not found, because it is searching the requested resource in the directory /servlet/html/hello.jsp.
I wanted to ask that, in this case, should SERVLET be the directory existing on root directory or it can be logical name also, then in that case
how would the RequestDispatcher relative path should have been given. Please help.
Ben