[英]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:
prefix或RedirectView
做到這一點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.