@RequestMapping(value = "exeJsTest-modelAndView-returned")
public ModelAndView testExeJsModelAndView(Model model) {
setTestVariables(model);
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("booking");
return modelAndView;
}
@RequestMapping(value={"/", "/login"}, method = RequestMethod.GET)
public ModelAndView login(){
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("login");
return modelAndView;
}
public ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView mv = new ModelAndView();
mv.setViewName("hello");
mv.addObject("message", "Spring 4 MVC Hello World<br>Class Name Handler Mapping Example");
return mv;
}
@RequestMapping(value = "/welcome", method = RequestMethod.GET)
public ModelAndView welcome() {
ModelAndView model = new ModelAndView();
model.setViewName("welcome");
return model;
}
@RequestMapping("/error")
public ModelAndView handleError() {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("error");
return modelAndView;
}
public ModelAndView
defaultErrorHandler(HttpServletRequest req, Exception e) throws Exception {
// If the exception is annotated with @ResponseStatus rethrow it and let
// the framework handle it - like the OrderNotFoundException example
// at the start of this post.
// AnnotationUtils is a Spring Framework utility class.
logger.error("exception: {}", e);
if (AnnotationUtils.findAnnotation
(e.getClass(), ResponseStatus.class) != null) {
throw e;
}
// Otherwise setup and send the user to a default error-view.
ModelAndView mav = new ModelAndView();
mav.addObject("exception", e);
mav.addObject("url", req.getRequestURL());
mav.setViewName(DEFAULT_ERROR_VIEW);
return mav;
}
@RequestMapping("/multipleChoiceResult")
public ModelAndView multipleChoiceResult(ModelAndView mav, int questionNo, String answer) throws SQLException {
System.out.println("questionNo:" + questionNo);
System.out.println("answer:" + answer);
int result = questionService.checkAnswer(questionNo, answer);
boolean resultBoolean=false;
if(result!=0) resultBoolean=true;
mav.addObject("result", resultBoolean);
mav.addObject("questionNo", questionNo);
mav.addObject("multipleChoice", "multipleChoice");
mav.setViewName("/question/general/generalResult");
return mav;
}
@RequestMapping(value="managerCheckRentHouseinit.do", method={RequestMethod.GET,RequestMethod.POST})
public ModelAndView managerCheckRentHouseinit(HttpServletRequest request) {
ModelAndView modelAndView = new ModelAndView();
HttpSession session = request.getSession();
List<RentHouse> rentHouseList = rentHouseDao.selectAllRentHouse();
session.setAttribute("rentHouseList", rentHouseList);
modelAndView.setViewName("SystemUser/managerCheck");
return modelAndView;
}
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws IOException {
if (modelAndView != null) {
if (modelAndView.getModel().containsKey("currentTabWrapped")) {
final Object tabObject = modelAndView.getModelMap().get("currentTabWrapped");
if (tabObject instanceof ProposalTabWrapper) {
ProposalTabWrapper currentTabWrapped = (ProposalTabWrapper) tabObject;
if (!currentTabWrapped.getCanAccess()) {
modelAndView.setViewName(ErrorText.ACCESS_DENIED.flashAndReturnView(request));
}
}
}
}
}
@RequestMapping(value = "/rssfeed", method = RequestMethod.GET)
public ModelAndView getFeedInRss() {
List<RssBatchStatus> items = new ArrayList<RssBatchStatus>();
List<BatchInstanceStatus> statusList = new ArrayList<BatchInstanceStatus>();
statusList.add(BatchInstanceStatus.READY_FOR_REVIEW);
statusList.add(BatchInstanceStatus.READY_FOR_VALIDATION);
List<BatchInstance> batchInstances = batchInstanceService.getBatchInstanceByStatusList(statusList);
for (BatchInstance batchInstance : batchInstances) {
RssBatchStatus status = new RssBatchStatus(batchInstance);
items.add(status);
}
ModelAndView mav = new ModelAndView();
mav.setViewName("rssViewer");
mav.addObject("feedContent", items);
return mav;
}