나는 그것이 일을한다고 생각한다. 검색 패턴을 세션을 통해 편집 작업에 전달합니다. 업데이트 된 검색 결과를 표시하려면 검색 페이지로 리디렉션 할 때 사용할 수 있습니다.
@Controller
public class ProjectsController {
@RequestMapping(value = "edit", method = RequestMethod.POST)
String doEditProject(HttpSession httpSession, @ModelAttribute Project p) {
// persist the edited project
// redirect to search page with last search word
String searchPattern = (String) httpSession.getAttribute("search_pattern");
return "redirect:search?pattern=" + searchPattern;
}
@RequestMapping(value = "search", method = RequestMethod.GET)
String displaySearch(@RequestParam(value = "pattern", required = false) String searchPattern, ModelMap model, HttpSession httpSession) {
if (searchPattern == null) {
// display empty search view
return "searchView";
} else {
// search using the pattern
// put model and create links like edit?project_id=xx
httpSession.setAttribute("search_pattern", searchPattern);
return "searchView";
}
}
}
자습서를 통해 알아 낸 경우 지금까지 시도한 내용은 무엇입니까? – Shahzeb
문제 설명에 UI의 작동 방식에 대한 중요한 정보가 없습니다. 무엇을 새로 고침해야합니까? 검색 양식? 검색 결과? –
annotations base spring mvc를 사용하고 있습니까? –