繁体   English   中英

浏览器后退按钮支持

[英]Browser back button support

单击浏览器后退按钮后,它将发送一个发布请求,浏览器不允许它再次发送一个发布请求,并且显示一个关于重新提交页面的确认信息,如何在使用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;
}

您只需在POST到某些URL之后使用重定向 您可以使用redirect: prefixRedirectView做到这一点。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM