I am following the book 'Getting started with the spring framework'(sec. edition).In ch11-bankapp, functions with @ModelAttribute do not return a view name. Hence, the view name is supposed to be returned by RequestToViewNameTranslator.
@Controller
@RequestMapping(value = "/fixedDeposit")
public class FixedDepositController {
private static Logger logger = Logger
.getLogger(FixedDepositController.class);
@Autowired
private FixedDepositService fixedDepositService;
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ModelAttribute(value = "fdList")
public List<FixedDepositDetails> listFixedDeposits() {
logger.info("listFixedDeposits() method: Getting list of fixed deposits");
return fixedDepositService.getFixedDeposits();
}
however, when I enter the url http://localhost:8080/ch11-bankapp/fixedDeposit/list it gives me the HTTP Status 404 - error. The console gives me the following warning
WARN org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/ch11-session-attributes/fixedDeposit/list] in DispatcherServlet with name 'bankapp'
Can someone please explain me why?
p.s I am running the book's source code. The book assumes that the code is perfect. However it is not working.