1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.web.servlet.mvc.annotation;
18
19 import java.io.IOException;
20 import javax.servlet.http.HttpServletResponse;
21
22 import org.springframework.stereotype.Controller;
23 import org.springframework.web.bind.annotation.RequestMapping;
24 import org.springframework.web.bind.annotation.RequestMethod;
25
26
27
28
29 @Controller
30 @RequestMapping("/*.do")
31 public class MethodNameDispatchingController {
32
33 @RequestMapping
34 public void myHandle(HttpServletResponse response) throws IOException {
35 response.getWriter().write("myView");
36 }
37
38 @RequestMapping
39 public void myOtherHandle(HttpServletResponse response) throws IOException {
40 response.getWriter().write("myOtherView");
41 }
42
43 @RequestMapping(method = RequestMethod.POST)
44 public void myLangHandle(HttpServletResponse response) throws IOException {
45 response.getWriter().write("myLangView");
46 }
47
48 @RequestMapping(method = RequestMethod.POST)
49 public void mySurpriseHandle(HttpServletResponse response) throws IOException {
50 response.getWriter().write("mySurpriseView");
51 }
52
53 }