浏览器后退按钮支持

时间:2013-03-19 05:49:54

标签: java spring browser

点击浏览器后退按钮后,它发送一个帖子请求,浏览器不允许它再次发送一个帖子请求,并显示一个确认重新提交页面如何避免使用spring框架的java页面。

发布请求代码如下:

@RequestMapping(method = RequestMethod.POST, params = "action=search_by_name")
public ModelAndView searchByName(@RequestParam("contactName") String contactName, HttpSession session, WebRequest request) {
    ModelAndView mav = new ModelAndView(determineSearchSummaryView(request));

    ContactSearchHelper helper = new ContactSearchHelper(contactName);

    // After all the selections they made lets filter out based on the limited Territories
    CustomerUser user = (CustomerUser) userService.getLoggedInUser();
    helper.preFilterTerritories(user.getTerritories());

    EntitySearchCriteria criteria = helper.asCriteria(searchService);
    addSummaryCounts(mav, criteria, searchService);

    Long savedSearchId = searchService.save(criteria, SavedSearchType.CONTACT, false).getId();
    helper.setSavedSearchId(savedSearchId);
    session.setAttribute(getSearchHelperParam(), helper);
    session.setAttribute("contactDiscovery", "false");
    addAccordionData(mav, null);
    addExtraModelData(mav);
    return mav;
}

1 个答案:

答案 0 :(得分:0)

你只是need to use redirects after POSTing to some URL。您可以使用redirect: prefixRedirectView执行此操作。