本文整理匯總了Java中org.springframework.web.context.request.WebRequest.getParameter方法的典型用法代碼示例。如果您正苦於以下問題:Java WebRequest.getParameter方法的具體用法?Java WebRequest.getParameter怎麽用?Java WebRequest.getParameter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.web.context.request.WebRequest
的用法示例。
在下文中一共展示了WebRequest.getParameter方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showPayouts
import org.springframework.web.context.request.WebRequest; //導入方法依賴的package包/類
@RequestMapping("/payouts")
public String showPayouts(Model model, WebRequest request){
int year = 0;
int month = 0;
if(request.getParameter("year") != null && request.getParameter("month") != null){
year = !request.getParameter("year").equals("") ? Integer.parseInt(request.getParameter("year")) : 0;
month = !request.getParameter("month").equals("") ? Integer.parseInt(request.getParameter("month")) : 0;
model.addAttribute("year",year);
model.addAttribute("month",month);
}
logger.debug("Requested year: {} Requested month: {}",year, month);
if(year != 0 && month != 0 && !request.getParameter("currency").isEmpty()){
if(!request.getParameter("currency").equals("EUR")){
model.addAttribute(request.getParameter("currency"));
}
Currency currency = Currency.getInstance(request.getParameter("currency"));
logger.trace("List all employees payments in year {} month {}",year,month);
List<Pair<Employee,Payout>> payoutList = paymentService.getAllPayoutsInCurrency(year,month,currency);
if(payoutList.size() > 0){
model.addAttribute("payoutList",payoutList);
}
}
model.addAttribute("title","Employee Payments");
return viewPrefix+"payments";
}