你可以做请求转发
boolean dateFlag = Boolean.getBoolean(request.getParameter("dateFlag")); //Get the dateFlag value in the `doStuff` handler method
if(dateFlag){
request.getRequestDispatcher("doStuffOld").forward(request, response);
return null;
}
在您的myapp/doStuff
处理程序中,您可以检查标志并将请求转发到新的 url( doStuffOld
),您可以使用params选项。
如果使用RequestMapping并且您不希望调用旧处理程序,则另一种解决方案doOldStuff
@RequestMapping(value="doStuff", params="dateFlag=true")
public ModelAndView doStuff(HttpServletRequest request, HttpServletResponse response){
....
}
@RequestMapping(value="doStuff", params="dateFlag=false")
public ModelAndView doOldStuff(HttpServletRequest request, HttpServletResponse response){
....
}