// find a users payment cards - via AJAX @RequestMapping( value = "{username}/view.json", method = RequestMethod.GET, headers = "Accept=application/json") public @ResponseBody List<PaymentCard> view(@PathVariable String username) { List<PaymentCard> cards = paymentCardService.findPaymentCards(username); return cards; }
// list all of the users PaymentCards - form @RequestMapping(method = RequestMethod.GET) public String listForm(Model model, Principal currentUser) { List<PaymentCard> paymentCards = null; if (currentUser != null) { paymentCards = paymentCardService.findPaymentCards(currentUser.getName()); } model.addAttribute("paymentCardList", paymentCards); return "cards/list"; }