In liferay-portlet.xml we have to add the following
3 elements.
1. Mapper class
2. Mapping url
3. Route xml file
In all cases ,Mapper Class is same.
com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper.
1. Mapper class
2. Mapping url
3. Route xml file
In all cases ,Mapper Class is same.
com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper.
The mapping is a name by which this route can be
identified, and the route is a xml file,that describes how to map various
parameters to a more friendly look.
Liferay-portlet.xml :
after
<icon>tag and before
<instanciable> tag.
<friendly-url-mapper-class>
com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper
</friendly-url-mapper-class>
<friendly-url-mapping>formaccess</friendly-url-mapping>
<friendly-url-routes>
com/furl/unsubscribe-friendly-url-routes.xml
</friendly-url-routes>
Create the following xml file under the package
com.furl package
unsubscribe-friendly-url-routes.xml:
<?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>/{jspPageName}</pattern>
<generated-parameter
name="jspPage">/html/friendlyurl/{jspPageName}.jsp</generated-parameter>
</route>
</routes>
Now create the subscribe.jsp under html/furl.
Check the
friendly urls:
http://localhost:8080/web/oneclicksite/friendly-url/-/formaccess/subscrbe
http://localhost:8080/web/oneclicksite/friendly-url/-/formaccess/view
http://localhost:8080/web/oneclicksite/friendly-url/-/formaccess/edit