Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Tsena N
Multiple parameters in Friendly Url
November 29, 2016 1:09 AM
Answer

Tsena N

Rank: New Member

Posts: 2

Join Date: August 11, 2016

Recent Posts

Hi there.
I have a problem that I can not get the correct value of 2nd parameter from friendly url mapping of portlet in JSF

For only 1 parameter it works well.

I followed this as a reference:

https://zenidas.wordpress.com/recipes/liferay-friendly-url-using-jsf/


my route is defined as:

<route>
<pattern>/{categoryemoticon([a-zA-Z0-9]+)[-]?([a-zA-Z0-9]+))*}/{pageemoticon[0-9]+)*}</pattern>
<implicit-parameter name="p_p_id">_category_WAR_category_</implicit-parameter>
<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
<implicit-parameter name="p_p_state">normal</implicit-parameter>
<implicit-parameter name="p_p_mode">view</implicit-parameter>
<implicit-parameter name="_facesViewIdRender">/WEB-INF/category/list.xhtml</implicit-parameter>
</route>

Then I call my URL as:

http://localhost:8080/category/food/3

But both category and page parameters are receiving the same value = food.

Any help with this?

Thank you in advance,
Xena
Vernon Singleton
RE: Multiple parameters in Friendly Url
January 6, 2017 8:41 AM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Expert

Posts: 302

Join Date: January 14, 2013

Recent Posts

Hi Xena,

Tsena N:
Then I call my URL as:

http://localhost:8080/category/food/3

But both category and page parameters are receiving the same value = food.

I am not sure how the "parameters are receiving the same value", but this might help ... you could look at our jsf-showcase-portlet which uses friendly urls with 3 main parameters called componentPrefix, componentName, and componentUseCase.

Here are the routes for that portlet. You can search for ViewParameters in the source code to see how we populate them and use them.

If you are still having problems, please use one of our archetypes to create a short, self-contained example of your issue, and I would be happy to help you further.

Hope that helps,
Vernon
Tsena N
RE: Multiple parameters in Friendly Url
January 17, 2017 2:50 AM
Answer

Tsena N

Rank: New Member

Posts: 2

Join Date: August 11, 2016

Recent Posts

Thank you Vermon.
your example is useful and easy to understand.
Vernon Singleton
RE: Multiple parameters in Friendly Url
January 17, 2017 6:49 AM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Expert

Posts: 302

Join Date: January 14, 2013

Recent Posts

Thank you for the encouragement.
Enjoy using Liferay Faces.

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!