Simplify Spring 2.5 MVC configuration with Java annotations.
Steps:
Use @Controller to make class to handler web request
Use @RequestMapping to map with Url
Here is the code that maps url pattern with method.
import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping; @Controllerpublic class SimpleController { @RequestMapping("/index.html") public void indexHandler() { } @RequestMapping("/about.html") public void aboutHandler() { } @RequestMapping("/admin.html") public void adminHandler() { }
No comments:
Post a Comment