I have the following sturcture in my app
--Controller
|_ServletA
|_ServletB
--Webpages
|_Secure
|_PageA
|_PageB
|_PageC
Now the application starts with PageC which posts to ServletB.The ServletB forwards to PageA.
Now from PageA a link is clicked which points to ServletB . The servletB does some work and forwards to PageB.At this stage the address on the url is http://localhost:8080/MyApp-war/Secure/PageB.jsp.
Here is the problem now a link on PageB points back to ServletB. The link is
<a href="ServletB">
Therefore the browser points to http://localhost:8080/MyApp-war/Secure/ServletB which is wrong as it should be http://localhost:8080/MyApp-war/ServletB.
How can I fix this problem without changing the link to ServletB from pageB, Since it works okay in first attempt but when the relative address changes it fails ?
EDIT :
In short what I want to know is what should i place in the link
<a href="ServletB">
so that if the relative address is http://localhost:8080/MyApp-war/Secure/ it points to http://localhost:8080/MyApp-war/ServletB instead of http://localhost:8080/MyApp-war/Secure/ServletB and if the relative address is http://localhost:8080/MyApp-war/ it takes it to the same location http://localhost:8080/MyApp-war/ServletB