Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Sid L
Liferay friendly url - passing parameters
18. Januar 2011 10:46
Antwort

Sid L

Rang: Junior Member

Nachrichten: 28

Eintrittsdatum: 2. Dezember 2010

Neue 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?
Krishna Melkote
RE: Liferay friendly url - passing parameters
19. Januar 2011 06:27
Antwort

Krishna Melkote

Rang: Junior Member

Nachrichten: 52

Eintrittsdatum: 22. September 2010

Neue 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
RE: Liferay friendly url - passing parameters
12. September 2011 01:09
Antwort

Rohit Chaudhari

Rang: Junior Member

Nachrichten: 29

Eintrittsdatum: 8. September 2011

Neue 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
RE: Liferay friendly url - passing parameters
1. Juni 2012 01:35
Antwort

Lennart Kruse

Rang: New Member

Nachrichten: 7

Eintrittsdatum: 31. Mai 2012

Neue Beiträge

Hi,
did you manage to read the param? I have the same issue, see here.
Best,
Lennart