-
Notifications
You must be signed in to change notification settings - Fork 164
Expand file tree
/
Copy pathCheckoutController.java
More file actions
38 lines (26 loc) · 970 Bytes
/
CheckoutController.java
File metadata and controls
38 lines (26 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package guru.springframework.controllers;
import guru.springframework.comands.CheckoutCommand;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.validation.Valid;
/**
* Created by jt on 2/1/16.
*/
@Controller
public class CheckoutController {
@RequestMapping("/checkout")
public String checkoutForm(Model model){
model.addAttribute("checkoutCommand", new CheckoutCommand());
return "checkoutform";
}
@RequestMapping(value = "/docheckout", method = RequestMethod.POST)
public String doCheckout(@Valid CheckoutCommand checkoutCommand, BindingResult bindingResult){
if (bindingResult.hasErrors()) {
return "checkoutform";
}
return "checkoutcomplete";
}
}