29 March 2011

Spring framework - best practices. Controller

It is good to have a controller (super class)  which that will extend by every controller , where you can put all methods that will be aplication wide used.

MothersuperiorController (usuall called abstracController or BaseController) where you
//package and all imports 
@Controller
public class MothersuperiorController{
 
public void home() {
//methods that can be used by every controller 
}

}

and each controller  should extend above controller

// package and all imports
@Controller
public class SlaverController extends MothersuperiorController{
//do amazing controller job
}