0

I have two portlets : 1. Blog Portlet. 2. Author Portlet.

  • I used the concept of Public render parameter to send data (say key "urlTitle") from Blog portlet to Author portlet
  • But after sending "urlTitle" from Blog portlet how can I remove the data from Public render parameter
In Blog Portlet
EX code: view.jsp

<portlet:renderURL var="viewEntryURL">
    <portlet:param name="struts_action" value="/blogs/view_entry" />
    <portlet:param name="redirect" value="<%= currentURL %>" />
    <portlet:param name="urlTitle" value="<%= entry.getUrlTitle() %>" />
</portlet:renderURL>

<a href="${viewEntryURL}">Send Data</a>

Now how I can remove "urlTitle" form the public render parameter after data is sent.

Please give feedback. -Thanks in advance

  • You're asking for a backend-concept (modifying public render parameters), but post the construction of HTML in an unknown position. Public Render Parameters (PRP) are a concept from the portlet specification - and just adding one extra parameter to the URL doesn't make it a PRP. In other words: I'm neither able to reproduce what you're doing, nor do I have a clue what you actually want to achieve with this and in which place you want to "remove" something. Please rewrite your question, consider https://stackoverflow.com/help/mcve and give us the underlying business problem. – Olaf Kock Mar 28 '19 at 08:20
  • I have did configuration for public render parameter with the identifier "urlTitle" in portlet.xml file for both the portlets. I just set urlTitle to PRP from Blog portlet and get this "urlTitle" in Author portlet. Fine working till here. But now i want to remove this "urlTitle" parameter from PRP as get its value in Author portlet. – Saurabh khandelwal Mar 28 '19 at 10:18
  • **Made correction in comment:** I have did configuration for public render parameter with the identifier "urlTitle" in portlet.xml file for both the portlets. I just set urlTitle to PRP from Blog portlet and get this "urlTitle" in render phase of Author portlet. Fine working till here. But now i want to remove this "urlTitle" parameter from PRP as get its value in Author portlet. Because as it is stored as PRP for whole session it creates issue for other stuff. Ex: After clicking on "Add New" button of Blog portlet Form already field up with the Blog details whose urlTitle is stored in PRP – Saurabh khandelwal Mar 28 '19 at 10:30

2 Answers2

0

You could think about the following:

The LiferayPortletURL (the class that models portlet render, action and resource URLs tags) offers a method called setCopyCurrentRenderParameters

https://docs.liferay.com/portal/6.2/javadocs/com/liferay/portal/kernel/portlet/LiferayPortletURL.html#setCopyCurrentRenderParameters(boolean)

which when set to false, avoids copying render parameters, and the URLs are "cleaned" from those.

The caveat with this is that you would need to create a LiferayPortletURL in the back end doing the following:

    LiferayPortletURL renderUrl = PortletURLFactoryUtil.create(
            httpServletRequest,
            themeDisplay.getPortletDisplay().getId(),
            themeDisplay.getPlid(),
            PortletRequest.RENDER_PHASE);
    renderUrl.setCopyCurrentRenderParameters(false);

and after that pass it to your JSP set as an attribute (maybe renderRequest.setAttribute("renderUrl",renderUrl)?). I haven't done this for render URLs, but for resource URLs and it works!

evaldeslacasa
  • 582
  • 6
  • 17
0

You need to set

javax.portlet.init-param.copy-request-parameters=false 

in your portlet class.

David Buck
  • 3,752
  • 35
  • 31
  • 35