This repository has been archived on 2020-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
e-commerce/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java

28 lines
693 B
Java
Raw Normal View History

package org.hso.ecommerce.app;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class RequestController {
@GetMapping("/")
public String greeting() {
return "redirect:/home";
}
@GetMapping("/home")
public String home() {
return "home";
}
@GetMapping("/greeting")
public String greeting(@RequestParam(name = "name", required = false, defaultValue = "World") String name, Model model) {
model.addAttribute("name", name);
return "greeting";
}
}