Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add request param example

  • Loading branch information...
commit 357ddef8b207139bacfd76cc6c95c7dd42254cc0 1 parent 476d771
@ustun authored
Showing with 17 additions and 7 deletions.
  1. +17 −7 src/main/java/xyz/sample/baremvc/HomeController.java
View
24 src/main/java/xyz/sample/baremvc/HomeController.java
@@ -1,17 +1,27 @@
package xyz.sample.baremvc;
import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class HomeController {
-
+
@RequestMapping(value="/")
- public String home() {
-
- System.out.println("Homecontroller:passing through");
- return "home2";
- }
+ public String home() {
+
+ System.out.println("Homecontroller:passing through");
+ return "home2";
+ }
+
+ @RequestMapping(value="/userInput")
+ public String compare(@RequestParam("input1") String input1, Model model) {
+ String output = "The number you have " + input1;
+ model.addAttribute("output", output);
+ return "compareResult";
+ }
+
}
-
+
Please sign in to comment.
Something went wrong with that request. Please try again.