wood burning stoves*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 316

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: 316

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Page redirect not working
 
Similar Threads
javax.servlet.ServletException: No adapter for handler
org.springframework.beans.factory.BeanCreationException
Issue with adding spring 3.0 to existing jsf 1.1 project
Spring : how to redirect to login page on session timeout
The requested URL /market/spring/home was not found on this server