I use spring annotations, I wrote one method
public ModelAndView showTestPage(@RequestParam("firstInstanceId") String id1, @RequestParam("secondInstanceId") String id2, HttpSession session) { ModelAndView mv = new ModelAndView("showCompareItemList"); mv.addObject("pageTitle", "showCompareItemList"); mv.addObject("firstInstanceId", id1); mv.addObject("secondInstanceId", id2); return mv; }
when both id1 and id2 are present, it works fine, but when there is only one value, I get an org.springframework.web.bind.MissingServletRequestParameterException exception: The required parameter java.lang.String 'secondInstanceId' is missing I tried to solve this problem by checking zero, but still I get this exception. Can anyone tell me what to do to avoid this exception?
spring spring-mvc
Vipul
source share