掲示板

Appending the parameter to community home page URL

11年前 に Sunil Kulkarni によって更新されました。

Appending the parameter to community home page URL

Junior Member 投稿: 94 参加年月日: 11/06/24 最新の投稿
Hello All,

I have done following :
1. I have created open community named with 'bookshelf'. This community having only one page with layout 1 column.
2. I have create a portlet 'Books' and I have deployed that portlet on home page of the 'bookshelf' community. This book portlet having category wise data.

Now, the friendly url generated for the community 'bookshelf' is http://localhost:8080/web/bookshelf/home. So when any user directly copy and paste this URL in the browser, he can see the 'books' portlet.

Now I am achieving following:
Any user can give the category as parameter to the books portlet so that according to the parameter the book portlet will display the listing of the books.
e.g. If I typed http://localhost:8080/web/bookshelf/home?category=technical then book portlet should display the listing of books for category technical and if I typed http://localhost:8080/web/bookshelf/home?category=medical then book portlet should display the listing for medical category.

My question is :
Is this a valid way to pass this category parameter as mentioned above. In liferay, we are not directly appending the parameter as mentioned above.

Any thoughts will be very helpful.
11年前 に Sunil Kulkarni によって更新されました。

RE: Appending the parameter to community home page URL(Resolved)

Junior Member 投稿: 94 参加年月日: 11/06/24 最新の投稿
I have resoved this issue using portlet friendly URL.

I did the following :
1. Created a bookshelf.xml for friendly url
it contains following:
     <routes>
          <route>
	<pattern>/{categoryName}</pattern>
	<generated-parameter name="categoryName">{categoryName}</generated-parameter>
          </route>
      </routes>

2. Added the following in liferay-portlet.xml
     <friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
     <friendly-url-mapping>bookshelf</friendly-url-mapping>
     <friendly-url-routes>bookshelf.xml</friendly-url-routes>


3. Now my friendly URL is http://localhost:8080/web/bookshelf/home/-/bookshelf/technical

4. I can access categoryName in my portlet using
String categoryName = ParamUtil.get(request, "categoryName", "");
11年前 に Praveen Motamarri によって更新されました。

RE: Appending the parameter to community home page URL

New Member 投稿: 1 参加年月日: 10/02/05 最新の投稿
You can retrieve the parameter in the jsp like this
String category = PortalUtil.getOriginalServletRequest(request).getParameter("category");