我對Spring MVC Portlet控制器有一些疑問。定義默認的Portlet操作方法
我想定義一個控制器,它將繪製的portlet首次,從Portlet的任何後續操作將觸發相應的操作方法
@Controller("searchController")
@RequestMapping("VIEW")
public class SearchController {
@RenderMapping
public String showSearch(RenderRequest request, Locale locale, Model model) {
logger.info("Loading the Search Bar");
return "search";
}
@ActionMapping("") //default action that should be executed for first time
public void fetchSearchDetails(ActionRequest request, ActionResponse response, SessionStatus sessionStatus) {
logger.info("Searching the Refinement");
}
@ActionMapping("searchAction")
public void searchProduct(@Valid @ModelAttribute(value = "product") Product product, BindingResult bindingResult,
ActionRequest request, ActionResponse response, SessionStatus sessionStatus) {
//execute if actionURL is searchAction
}
}
如何申報/調用默認的操作方法,如果該portlet將首次加載或不執行任何操作。