@RequestMapping (value = "/gethomeworkinfo.json", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/json")
public @ResponseBody
HomeworkReport getHomeworkReportInfo(@RequestParam (value = "schoolid", required = false) String schoolId, @RequestParam (value = "homeworkid") String homeworkId,
@RequestParam (value = "startdate", required = false, defaultValue = "2014-06-01") @DateTimeFormat (pattern = "yyyy-MM-dd") Date startdate,
@RequestParam (value = "enddate", required = false, defaultValue = "2014-12-30") @DateTimeFormat (pattern = "yyyy-MM-dd") Date enddate,
@RequestParam (value = "userid", required = false) String userId, HttpServletRequest request) {
// some actions
}
我目前使用这种方法。它会帮助你。