This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Spring and the fly likes Page redirect not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Page redirect not working" Watch "Page redirect not working" New topic
Author

Page redirect not working

pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 321

Hi,

In the below program, when I submit the login.jsp page, I get the "org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/Bookstore/index] in DispatcherServlet with name 'appServlet' message.The index.jsp page is in WEB-INF/views folder.

If I write return "index" instead of "redirect:/index" it works fine. Also If I move the index.jsp page out of the WEB-INF/views folder and keep it inside WebContent, it works fine when written as return "index.jsp". So how to redirect to a different page which is inside WEB-INF/views folder.

the WEB-INF/spring/appServlet/servlet-context.xml is as follows :
Please advise.


Thanks,
Pramod
pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 321

Also If I move the index.jsp page out of the WEB-INF/views folder and keep it inside WebContent, it works fine when written as return "index.jsp".

Here, it works fine when written as return "redirect:/index.jsp".

I found out the answer for this problem.
The dispatcher servlet couldn't locate any mapping for /Bookstore/index. So I modified the LoginController class


The only problem I see here is that the LoginController class has no more @RequestMapping available.
However, the tutorial I'm following has got the program running without this modification.
 
GeeCON Prague 2014
 
subject: Page redirect not working