下面是我的控制器
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public String ABC(Registratio registration, ModelMap modelMap,
HttpServletRequest request,HttpServletResponse response){
if(somecondition=="false"){
return "notok"; // here iam returning only the string
}
else{
// here i want to redirect to another controller shown below
}
}
@RequestMapping(value="/checkPage",method = RequestMethod.GET,)
public String XYZ(ModelMap modelMap,
HttpServletRequest request,HttpServletResponse response){
return "check"; // this will return check.jsp page
}
Run Code Online (Sandbox Code Playgroud)
由于控制器ABC是@ResponceBody类型,它将始终作为字符串返回,但我希望在其他情况下它应该被重定向到XYZ控制器,并从中返回一个我可以显示的jsp页面.我尝试使用return"forward:checkPage"; 还有 返回"redirect:checkPage"; 但不起作用.任何帮助.
谢谢.
问题出在标题中:是<jsp:forward>或RequestDispatcher.forward使用GET或POST来做它的事情?
如果它使用一个,我可以一直计算它会是一个还是可以因服务器而异?
谢谢你们!