Question: 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?

Answer: 
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.
JSPs must not include any code that requires dependency injection. So don't do it.

If you really must, you can use 

```
<%!
    public void init() {
        ApplicationContextUtils.getRequiredWebApplicationContext(
             getServletContext()).getAutowireCapableBeanFactory()
             .autowireBean(this);
    }
%>

```

But this is extremely ugly.