• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with getSuccessView

 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using a RedirectView, try to use the redirect prefix :
 
Siddharth Bhargava
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is also not working ......
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!