- Q-What is friendly URL?
- ans: Friendly URL is a technique to make short portlet URL.
- To make friendly URL, we need to define router xml for that portlet.
- In this router xml, we can define various parameters (implicit , explicit etc).
- We can define multiple friendly URL for same portlet.
example:-
<?xml version="1.0"?>
<!DOCTYPE routes PUBLIC "-//Liferay//DTD Friendly URL Routes 6.2.0//EN"
"http://www.liferay.com/dtd/liferay-friendly-url-routes_6_2_0.dtd">
<routes>
<route>
<pattern>/{jspPageName}</pattern>
<generated-parameter name="jspPage">/html/controller/{jspPageName}.jsp</generated-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>
</route>
</routes>
Step2- we need to add three line code in liferay-portlet.xml
<icon>/icon.png</icon><friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class><friendly-url-mapping>ekhub</friendly-url-mapping><friendly-url-routes>com/test/ccavenue-friendly-url-routes.xml</friendly-url-routes><instanceable>false</instanceable>
No comments:
Post a Comment