Spring mvc action redirect to action

/**
	 * 执行增加广告
	 * 
	 */
	@RequestMapping("/ads/insertAds.htm")
	@Purview(value = { PurviewEnum.无 })
	public void insertAds(ModelMap modelMap, AdsDTO adsDTO) {
		UserPassportDTO userPassportDTO = this.getCurrentUserPassport();
		boolean result = adsService.insertAds(adsDTO, userPassportDTO);

		try {
			// 添加session判断是否跳转到广告查询页面
			getSession().setAttribute("adsResult", result);
			getResponse().sendRedirect("/home.htm");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}


@RequestMapping(value = "new", method = RequestMethod.GET)
public String getNewUserForm(Model model) {
    model.addAttribute("action", "Create");
    model.addAttribute(new User());
    return "users/edit";
}

@RequestMapping(value = "create", method = RequestMethod.POST)
public String getCreateUser(@ModelAttribute("user") User user, BindingResult result, RedirectAttributes attr) {
    attr.addFlashAttribute("user", user);
    //  跳转的地方
    return "redirect:view";
}

@RequestMapping(value = "view", method = RequestMethod.GET)
public String getViewUser(Model model) {
    return "users/view";
}

你可能感兴趣的:(spring,mvc,action,redirect)