October 2017
Intermediate to advanced
396 pages
10h 2m
English
In a web application, we can fetch the request parameters from the request-the account ID in our example if you want to access the details of a particular account. Let's fetch the account ID from the request parameter using the following code:
@Controller
public class AccountController {
@GetMapping(value = "/account")
public String getAccountDetails (ModelMap model, HttpServletRequest request){
String accountId = request.getParameter("accountId");
Account account = accountService.findOne(Long.valueOf(accountId));
model.put("account", account);
return "accountDetails";
}
}
In the preceding code snippet, I have used the traditional way to access the request parameters. The Spring MVC framework provides an annotation, ...
Read now
Unlock full access