Here is the steps:
1. My view.jsp has a link to detail.jsp page.
<portlet:renderURL var="getFullTextURL"> <portlet:param name="myaction" value="fullText" /> <portlet:param name="guid" value="${channelArticle.guid }"/> <portlet:param name="friendlyUrl" value="${channelArticle.friendlyUrl}" /> </portlet:renderURL> <a href="<%=getFullTextURL%>"> <img src="${channelArticle.articleImageLink }" /> </a>
@RenderMapping(params = "myaction=fullText") public String requestFullText(RenderRequest renderRequest, RenderResponse renderResponse, @RequestParam String guid, @RequestParam String friendlyUrl) throws Exception { //code...}
3. Friendly url mapping.
<routes> <route> <pattern>/{friendlyUrl}.html</pattern> <ignored-parameter name="guid"/> <implicit-parameter name="myaction">fullText</implicit-parameter> </route> </routes>
In this case, it reports the error "Required String parameter is not present". This is because our friendly url mapping, there's no param named guid, so the method in the controller can't get the value of guid. This is an error which Spring reports other than Liferay.
@RenderMapping(params = "myaction=fullText") public String requestFullText(RenderRequest renderRequest, RenderResponse renderResponse, @RequestParam String friendlyUrl) throws Exception { //code }When we change method signature like this, it works.