简体   繁体   English

浏览器后退按钮支持

[英]Browser back button support

After clicking on browser back button it sends a post request and browser does not allow it to send a post request again and it displays a confirm for re submission page how to avoid this page in java with spring framework. 单击浏览器后退按钮后,它将发送一个发布请求,浏览器不允许它再次发送一个发布请求,并且显示一个关于重新提交页面的确认信息,如何在使用Spring框架的Java中避免该页面。

post request code is given below.. 职位要求代码如下。

@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;
}

You just need to use redirects after POSTing to some URL . 您只需在POST到某些URL之后使用重定向 You can do this with redirect: prefix or with RedirectView . 您可以使用redirect: prefixRedirectView做到这一点。

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

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