Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SPRING query: how to have more than one successview

 
Ashimashi Kabashi
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a spring controller class and I have set it's success view to a jsp page.
This binds the spring container to show the page mentioned in the success view on a form submit. But I want it to redirect based on some logic (like how struts does it for us with the ability to add multiple forwards for a single ActionClass ).

my controller class is:
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd put the logic in onSubmit(). All you'd need to do is return whatever view you want from this method, wrapped in a ModelAndView.
 
Ashimashi Kabashi
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
excellent ... Thanks
 
Sudhana Madhu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my doubt is how can we create another view (except formView and successView)?
can any body post the sample code for this ?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by MadhuE sudhana:
my doubt is how can we create another view (except formView and successView)?
can any body post the sample code for this ?


What do you mean another view. If you want another view you put that view name in the ModelAndView object, or just reset the success or form view.

I don't think you need more, without convoluting the api.

Mark
 
Sudhana Madhu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it
we can
viewName can be resolved based on the ViewResolver prefix and suffix properties.
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic