Tiles Controller

Let us to take a look how to reference Spring beans in Tiles controller

public class WorkSpaceSupport extends ControllerSpringSupport
{
@Spring(bean = BasicService.BEAN_NAME) public BasicService basicService;

public void execute(ComponentContext tileContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, WebApplicationContext applicationContext) throws Exception
{
request.setAttribute("applicationName", basicService.getApplicationName());
}
}

Because Tiles can be used seperated from Struts, so RequestProcessor can not controll Tiles controller creation, so a new controller implment class introduced. In above class, the new controller class should extend ControllerSpringSupport class, and implement the default method. In this method, ApplicationContext has been passed as parameter, so you can use Spring context easily.