This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi all, I am writing a sample login application. All my pages are under WEB-INF/jsp/ folder, only welcome page is in the root directory which in turn will forward the request to a page in WEB-INF/jsp/ directory using a controller.
My problem is with the relative paths. My project structure is:
In my webapp/welcome.jsp page the code is
This will forward the request to a WelcomeController in which I am resolving the view like this
This is my web.xml
This is how my beginner-servlet.xml looks likeMy AuthenticationConroller looks like this
The problem is when I forward the request to WEB-INF/jsp/welcome.jsp page the links is the page are getting a relative path like this
Now when I click on the register link it goes to AuthenticationController's showRegistrationForm method. It looks like this
Now in the register.jsp page I have some form with action mapped to a controller like thisNow the "back" link gets a relative path springbeginner/authentication/registerpage/welcome. When I click this it says 404 error. So I used This is hitting the WelcomeController. Is it good to put this ../../ in the code? or what approach should I take?
I hope all understood my problem. I think I explained a lot for a small problem, but I dint find any better way to explain. My apologizes.