File tree Expand file tree Collapse file tree 1 file changed +29
-28
lines changed
Chapter3-1-2/src/main/java/com/didispace/web Expand file tree Collapse file tree 1 file changed +29
-28
lines changed Original file line number Diff line number Diff line change 1- package com .didispace .web ;
2-
3- import org .springframework .stereotype .Controller ;
4- import org .springframework .ui .ModelMap ;
5- import org .springframework .web .bind .annotation .RequestMapping ;
6- import org .springframework .web .bind .annotation .RestController ;
7-
8- /**
9- *
10- * @author 程序猿DD
11- * @version 1.0.0
12- * @blog http://blog.didispace.com
13- *
14- */
15- @ Controller
16- public class HelloController {
17-
18- @ RequestMapping ("/hello" )
19- public String hello () {
20- return "Hello World" ;
21- }
22-
23- @ RequestMapping ("/" )
24- public String index (ModelMap map ) {
25- map .addAttribute ("host" , "http://blog.didispace.com" );
26- return "index" ;
27- }
28-
1+ package com .didispace .web ;
2+
3+ import org .springframework .stereotype .Controller ;
4+ import org .springframework .ui .ModelMap ;
5+ import org .springframework .web .bind .annotation .RequestMapping ;
6+ import org .springframework .web .bind .annotation .RestController ;
7+
8+ /**
9+ *
10+ * @author 程序猿DD
11+ * @version 1.0.0
12+ * @blog http://blog.didispace.com
13+ *
14+ */
15+ @ Controller
16+ public class HelloController {
17+
18+ @ ResponseBody
19+ @ RequestMapping ("/hello" )
20+ public String hello () {
21+ return "Hello World" ;
22+ }
23+
24+ @ RequestMapping ("/" )
25+ public String index (ModelMap map ) {
26+ map .addAttribute ("host" , "http://blog.didispace.com" );
27+ return "index" ;
28+ }
29+
2930}
You can’t perform that action at this time.
0 commit comments