spring mvc 3.0: put a bunch of .jsp files under spring's control

In my spring mvc 3.0 project I have a directory full of .jsp files (~150) which I want to put under spring's control.

Until now they where invoked by web.xml directly, without going thru the spring servlet.

From now, I want to put them all under spring's control to enjoy spring's goodies and make my project more uniform.

Of course, I don't want to write a single controller for each .jsp file. How can I do this?

Answers


In the case of a single JSP page you can use <mvc:view-controller>.

When you have many pages, you can write a catch-all controller like this:

@RequestMapping("/folder/{name}.jsp")
public ModelAndView catchAll(@PathVariable String viewName) {
    return new ModelAndView("legacy/" + viewName);
}

However, it may conflict with JSP processing servlet. If so, you need to apply some URL rewriting filter.


Need Your Help

Block element with height: 100%; & wrapper element – content overlaps

html css html5

I am trying to figure out how to combine HTML5 markup &amp; the layout of my website, which does not work as expected.

Facebook open-graph for iOS?

iphone ios facebook facebook-graph-api facebook-ios-sdk

I'm trying to implement like in the open-graph API for facebook. I've created a like on the facebook admin page.

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.