spring mvc重定向到jsp路径怎么写

2025-05-09 02:12:13
推荐回答(1个)
回答1:

@RequestMapping(value = "/test", method = {RequestMethod.GET})
public String ajaxSubmit(HttpServletRequest request, HttpServletResponse response,
final RedirectAttributes directAttributes)
{
// FlashAttribute页面重定向后数据存储在FlashMap中
directAttributes.addFlashAttribute("test", "0001");

// Attribute页面重定向后数据拼接到url后
directAttributes.addAttribute("test1", "0002");
return "redirect:/index.jsp";