File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55import javax .servlet .http .HttpSession ;
66
77import org .springframework .stereotype .Controller ;
8+ import org .springframework .web .bind .annotation .GetMapping ;
9+ import org .springframework .web .bind .annotation .PostMapping ;
810import org .springframework .web .bind .annotation .RequestMapping ;
911import org .springframework .web .bind .annotation .RequestParam ;
1012import org .springframework .web .bind .annotation .ResponseBody ;
1113import org .springframework .web .servlet .ModelAndView ;
1214
1315@ Controller
1416public class HomeController {
15- @ RequestMapping ("home" )
17+
18+
19+ @ GetMapping ("home" )
1620 public String home (@ RequestParam ("name" ) String myName ) {
1721
1822 ModelAndView mv =new ModelAndView ();
1923 mv .addObject ("name" , myName );
2024 mv .setViewName ("home" );
2125
22-
23- return "home" ;
26+ return "home" ;
2427 }
28+
29+
30+
2531}
Original file line number Diff line number Diff line change 77<title >Insert title here</title >
88</head >
99<body >
10- welcome ${ name }
10+ <form method =" get" action =" details" >
11+ Enter name: <input type =" text" name = " name" >
12+ <input type =" submit" >
13+ </form >
1114</body >
1215</html >
1316
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=ISO-8859-1"
2+ pageEncoding =" ISO-8859-1" %>
3+ <!DOCTYPE html>
4+ <html >
5+ <head >
6+ <meta charset =" ISO-8859-1" >
7+ <title >Insert title here</title >
8+ </head >
9+ <body >
10+ welcome ${ name }
11+ </body >
12+ </html >
You can’t perform that action at this time.
0 commit comments