I'm trying to work out why below exception is thrown.
I think it is because a portlet was accessed in 'view' mode but for a reason I do not know the spring servlet container was unable to serve the request, is this correct ?
Where are the 'parameters map' in below exception set ?
org.springframework.web.portlet.NoHandlerFoundException: No matching handler method found for portlet request: mode 'view', phase 'ACTION_PHASE', parameters map[empty]
Here is the controller :
@Controller
@RequestMapping("VIEW")
public class DetailsController {
@RequestMapping("VIEW")
public String showDetails(final ModelMap modelMap, final RenderRequest renderRequest) {
return "allDetails/details";
}
}
Here are 3 ideas I can come up with (knowing how your controller is called would help). Try one of them, or a mix of them, and tell me if it worked.
Idea 1 : Remove ("VIEW")
for the showDetails @RequestMapping annotation.
...
public class DetailsController {
@RequestMapping
public String showDetails(final ModelMap modelMap, final RenderRequest renderRequest) {
return "allDetails/details";
}
}
This could work if your calling JSP has something like this : <portlet:actionURL/>
: showDetails would be the default render method.
Idea 2 : Specify the action parameter for your @RequestMapping method annotation.
...
public class DetailsController {
@RequestMapping(params = "action=viewDetails")
public String showDetails(final ModelMap modelMap, final RenderRequest renderRequest) {
...
}
}
This could work if your calling JSP has something like this :
<portlet:actionURL ... >
<portlet:param name="action" value="viewDetails">
</portlet:actionURL>
Idea 3 : Add an empty method for the action phase.
...
public class DetailsController {
@RequestMapping(params = "action=viewDetails") // render phase
public String showDetails(final ModelMap modelMap, final RenderRequest renderRequest) {
...
}
...
// Empty method
@RequestMapping(params = "action=viewDetails") // action phase
public void actionMethod() {
}
}
This could work if your calling JSP has something like this :
<portlet:actionURL ... >
<portlet:param name="action" value="viewDetails">
</portlet:actionURL>
Couple of things to check here first:
Now if answer to first question is yes, then your jsp should have actionURL tag something like...
<portlet:actionURL var="myAction">
<portlet:param name="paramName" value="paramVal" />
</portlet:actionURL>
<form:form action="${myAction}"...
and its corresponding ActionMapping in Controller like...
@ActionMapping(params = "paramName=paramVal" )
public void myAction....
And if answer to second question is no, then define a default action method in the Controller like...
@ActionMapping(param="!action")
public void defaultAction....
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With