Permalink
Browse files

Add request param example

  • Loading branch information...
ustun committed Jan 13, 2012
1 parent 476d771 commit 357ddef8b207139bacfd76cc6c95c7dd42254cc0
Showing with 17 additions and 7 deletions.
  1. +17 −7 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";
+ }
+
}
-
+

0 comments on commit 357ddef

Please sign in to comment.