• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

SPRING query: how to have more than one successview

 
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:
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • 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
 
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 ?
 
ranger
Posts: 17344
11
Mac IntelliJ IDE 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
 
I was born with webbed fish toes. This tiny ad is my only friend:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!