I am having some doubt regarding Spring MVC Portlet Controller.
I would like to define a controller, which will paint the portlet for the first time, any subsequent actions from the portlet will trigger respective action methods
@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
}
}
How do I declare/call default Action method if the portlet is getting loaded for the first time or no action.
Try putting @ActionMapping
rather than @ActionMapping("").