Foren

Liferay friendly url - passing parameters

Sid L, geändert vor 13 Jahren.

Liferay friendly url - passing parameters

Junior Member Beiträge: 28 Beitrittsdatum: 03.12.10 Neueste Beiträge
consider the following liferay xml

<liferay-portlet-app>
<portlet>
<portlet-name>display</portlet-name>
<icon>/icon.png</icon>
<friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
<friendly-url-mapping>view</friendly-url-mapping>
<friendly-url-routes>com/test/navigation-routes.xml</friendly-url-routes>
<instanceable>false</instanceable>
<private-session-attributes>true</private-session-attributes>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>display-portlet</css-class-wrapper>
</portlet>

and the following is my navigation-routes.xml

<routes>
<route>
<pattern>/{id:\d+}</pattern>
<implicit-parameter name="id"></implicit-parameter>
</route>
</routes>

I am trying to access the above portlet by giving the link.
http://localhost:8080/displayPage/-/view/1234

The control seems to be reaching the portlet, however I am not able to retrieve the value passed (1234) in my portlet.
Any idea how this can be achieved?
thumbnail
Krishna Melkote, geändert vor 13 Jahren.

RE: Liferay friendly url - passing parameters

Junior Member Beiträge: 52 Beitrittsdatum: 22.09.10 Neueste Beiträge
Hi Sid,

I think, your routes might have a problem the implicit param is overriding what is coming in the furl. Try this.

<routes>
<route>
<pattern>/{id:\S+}</pattern>
</route>
</routes>
Rohit Chaudhari, geändert vor 12 Jahren.

RE: Liferay friendly url - passing parameters

Junior Member Beiträge: 29 Beitrittsdatum: 08.09.11 Neueste Beiträge
Hi All,

For sending parameters between Portlet A on 1st page to Portlet B1,B2,B3 on second page
We have tried the way you have mentioned,
We updated the B1 portlet's entry in liferay-portlet.xml file as follows:
<portlet>
<portlet-name>B1</portlet-name>
<friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
<friendly-url-mapping>view</friendly-url-mapping>
<friendly-url-routes>com/test/routes.xml</friendly-url-routes>
<instanceable>false</instanceable>
</portlet>

then we added a routes.xml as follows:
<routes>
<route>
<pattern>/{param1}</pattern>
</route>
</routes>

Now we changes the URL part in the portlet A as follows:

<a href="/<second page URL here>/-/view/${paramValue}"> Click here </a>

On clicking on the link we are able to see the appropriate URL in the browser with proper parameter values.

To get the parameter values In Portlet B1, render method we did

renderRequest.getParameter("param1");
but we are getting the param1 value as null. We are not sure what we are doing wrong.
It seems, we are very near of the solution. Your help will be appreciated.
Thanks,
Rohit
Lennart Kruse, geändert vor 11 Jahren.

RE: Liferay friendly url - passing parameters

New Member Beiträge: 7 Beitrittsdatum: 31.05.12 Neueste Beiträge
Hi,
did you manage to read the param? I have the same issue, see here.
Best,
Lennart