本文整理汇总了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";
}