Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Milan Kostoláni
Friendly URL problem
January 24, 2013 8:19 AM
Answer

Milan Kostoláni

Rank: Junior Member

Posts: 92

Join Date: July 26, 2012

Recent Posts

Hello everyone

Im having a problem to complete friendly URLs

the link looks like this
1...?_myportlet_WAR_myportlet_[u]value=10.0[/u]


I tried this:

1
2    <route>
3        <pattern>/view/{value}</pattern>
4        <ignored-parameter name="p_p_id"/>
5        <implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
6        <implicit-parameter name="javax.portlet.action">someAction</implicit-parameter>
7    </route>


also tried with {value:\d+}

However then it didnt work at all

Is there any solution for this?
Shashant Panwar
RE: Friendly URL problem
January 31, 2013 10:38 AM
Answer

Shashant Panwar

Rank: New Member

Posts: 21

Join Date: September 21, 2012

Recent Posts

Hi Milan,
Create a url-mapping.xml file in your resources.
Add the below entry in the file:

<?xml version="1.0"?>
<!DOCTYPE routes PUBLIC "-//Liferay//DTD Friendly URL Routes 6.1.0//EN" "http://www.liferay.com/dtd/liferay-friendly-url-routes_6_1_0.dtd">
<routes>
<route>
<pattern>/{value}</pattern> ----- try without "/view/"
<implicit-parameter name="p_p_resource_id">your resource name</implicit-parameter>
<implicit-parameter name="p_p_lifecycle">2</implicit-parameter>
<implicit-parameter name="p_p_cacheability">cacheLevelPage</implicit-parameter>
</route>
</routes>

Also,you need to add the below piece of code in your liferay-portlet.xml.
<portlet>
.....after icon
<friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
<friendly-url-mapping>your resource name which will map your url</friendly-url-mapping>
<friendly-url-routes>/urlMapping/you url-mapping.xml name</friendly-url-routes>
....
</portlet>

In my case,I created a resource,basically a hyperlink on which a new page with a friendly url.

I hope this will help.Good luck emoticon