wood burning stoves*
The moose likes Other Application Frameworks and the fly likes Problem with getSuccessView Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Problem with getSuccessView" Watch "Problem with getSuccessView" New topic
Author

Problem with getSuccessView

Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 257
Hi All,
I am developing an application of Spring with hibernate. The problem is my data is getting saved in the database, but the success page is not being rendered.

RegisterController.java


springhibernate-servlet.xml


registrationform


One thing to notice is that the registrationform is rendered correctly, but the successView isn't. I also to use

in the RegisterController but its also not working.


Please Help as I am not able to resolve this issue. If any further clarifications are needed then please do tell me.
Vilmantas Baranauskas
Ranch Hand

Joined: Dec 20, 2006
Posts: 89
I don't know Struts MVC well, but could it be that you are trying to redirect browser to ".../success".

I have 2 suggestions:
- Install Firefox with LiveHTTPHeaders extension. Then you can see what redirect is sent to browser.
- Try to use "new RedirectView("success.jsp",true)" and see if this works.


Author of <a href="http://www.newsinjector.com" target="_blank" rel="nofollow">NewsInjector</a>
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

getSuccessView() returns the name of the view. Only the name, not a path. You need to pass a path to the RedirectView, not a view name.


[My Blog]
All roads lead to JavaRanch
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 257

getSuccessView() returns the name of the view. Only the name, not a path. You need to pass a path to the RedirectView, not a view name.


How do i do this ?? Please give me a code snippet to cleat my concept.
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 257
How do i get my success page to be rendered. My success page is not coming although the data is being saved. It says :


HTTP Status 404 - /springhibernateapplication/success

--------------------------------------------------------------------------------

type Status report

message /springhibernateapplication/success

description The requested resource (/springhibernateapplication/success) is not available.

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Instead of using a RedirectView, try to use the redirect prefix :
Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 257
This is also not working ......
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Ok, sorry for posting garbage. I think that if you want to redirect to success.jsp, without using a controller, you'll have to give the path to the JSP, which means that it cannot be a path under WEB-INF. For example, in your context file :

Your controller. The whole point behind the "redirect:" prefix is to hide from the controller the fact that we are redirecting:

Under your root, you make a "jsps" directory and put success.jsp in it.

If you want to keep success.jsp under WEB-INF/jsps, I think that you'll have to make a controller in order to forward the request to the view, and make your successview look like :


If you don't go through a second controller, I don't see why you are redirecting anyway. You should be forwarding to the success page normally :

and


The big question is, why are you redirecting ?
T Ponraj
Greenhorn

Joined: Nov 07, 2007
Posts: 21
Dear Sidharth,

I m learning Spring and Hiberate, Your sample code looks like very easy to understand, can you please post send me your src to understand SpringMVC and Hibernate
Christy Vasanth
Greenhorn

Joined: Feb 28, 2010
Posts: 1
Hi,

Is it possible to display the same page in both

<property name="formView">

<property name="successView">
..

for eg. createemployee page shld be displayed in success view (with emp details in it)after employee details are saved in DB...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with getSuccessView
 
Similar Threads
Implementing HttpSession in the Spring MVC
Unable to Redirect to the On submitting a form
need help with basic spring mvc program... please help
Spring MVC question
Not able to Validate form using JSR-303 validation implementation in Spring MVC