can i set the url before returning the ModelAndView?

is it possible to set your url before returning your model?

For example, my current url is http://localhost/home.html at my homecontroller, I return a modelandview for another page, for example

ModelAndView model = new ModelAndView("contact");
model.addObject("contactNo", "12345");
return model;

then after returning the model, my contact.jsp has been loaded to my browser but it's url is still http://localhost/home.html, I want to change it to http://localhost/contact.html, how can i able to do that?

thanks

Answers


Try instantiating your ModelAndView like this,

ModelAndView model = new ModelAndView(new RedirectView("contact"));

Need Your Help

Laravel model inheritance

php model laravel laravel-4

I am using the Toddish/Verify library for Laravel as it includes 99% of what I need for my project. All I need is to add some fields.

Objective C - UITableViewCell crashing on scroll

objective-c uitableview

I have a UITableViewCell with a method like this.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.