Thursday, February 28, 2013

Passing parameter in JSF

In JSF, there are several ways to pass data from the client (browser) to the server.

1. value binding
Which is the default in JSF
value binding in JSF

2. f:param
passing parameter with f:param in JSF

to retrieve the value in managedBean, write the following codes.
passing parameter with f:param in JSF

3. f:setPropertyActionListener

Sunday, February 24, 2013

Workaround for p:column colspan

Recently, I was facing a problem with the p:datatable colspan attribute.
I wanted to conditionally colspan the table cell, but I failed to do that. And I found its impossible to do it now from the Primefaces forum.

conditional colspan in p:column

Finally, I came out with a workaround with jQuery.
Instead of the colspan attribute, I used the styleClass attribute to dynamically adjust the table's colspan.

Tuesday, February 19, 2013

How to setup Liferay Remote IDE Connector

Liferay Remote IDE Connector provides remote development and deployment support from Liferay IDE. With the help of this plugin, we may also enable the remote development and deployment to non-tomcat  Liferay bundled. 

This post shows the steps to setup the Liferay Remote IDE Connector and the target Liferay with JBoss bundled. 
Theoretically, it should works fine with other server bundled as well. 

Liferay 6.1.1
Eclipse Juno


1. Start the Remote Liferay instance or local non-tomcat Liferay instance.
2. Deploy the Server Manger Web plugin into the target Liferay instance. 
    put the downloaded lpkg file into the <TARGET_LIFERAY>/deploy folder

Friday, February 15, 2013

How to change portlet title's icon in Liferay

When we create a new portlet in Liferay with Liferay SDK, there come with a default icon in front of the portle title.
We can actually change the icon, so that it is more precise to present our portlet.

change Liferay portlet's title icon

The purpose to change the default icon is to differentiate our custom portlet with Liferay's portle, we can change the icon to our flagship logo, to increase users' awareness.

It is pretty simple to change the default title icon, below are the steps.

Wednesday, February 13, 2013

How to integrate OpenAM with Liferay for single sign on (SSO)

the objective of this post is to show the steps of how to enable SSO in Liferay with OpenAM.

1. OpenDJ is installed as LDAP for Liferay
2. OpenAM is installed.

Required software:
1. Liferay 6.1.1
2. OpenDJ 2.5
3. OpenAM 10.2

1. login to Liferay as Administrator
2. Go to > Control Panel > Portal Settings > Authentication > Open SSO
3. Fill in the following details

Saturday, February 9, 2013

rendered attribute in Primefaces

There is a known issue with the rendered attribute in Primefaces -- the element can't be updated if it doesn't exist in DOM. 
Thus, there could be problem to render it with ajax. 
<h:panelGroup id="pg" rendered="#{testBean.flag}">
    <h:outputLabel value="this is a panel group" />

above sample can't be render with ajax.

There are 2 workarounds to resolve the above situation.

Saturday, February 2, 2013

jQuery selector in JSF2

Ajax support is one of the major upgrade of JSF2 over JSF1.2.
with ajax support in JSF2, we can decide the list of components to be rendered with the "render" attribute, and the list of components to be executed on the server with the "execute" attribute.

<f:ajax listener="#{testBean.listener}" execute="id1 id2 id3" render="id1 id4" />

in some situations, we may want to execute or render many components. Thus, the list could be very long. and reduce development efficiency.

in this case, jQuery selector could be used to find components based on classes, types, id, etc instead of specifying a long list of component ids.

With jQuery selector, it could find only input components, or by element type, eg text, select.
Performance could be slightly improved because only required components are rendered or executed.

Dynamic Include

Dynamic include is a technique to programmatically include or toggle content into predefined position of a page. It can also uses to create wizard like application by toggle the contents of the wizard.

Benefits of dynamic include
- save bandwidth
- reduce page size
- reduce server memory with smaller component tree
- reduce page loading time

Disadvantages of dynamic include
- increase complexity

- How to create layout with dynamic include
- dynamic include in Richfaces tabPanel
- How to create wizard with dynamic include in JSF2
- Dynamic include with richfaces popupPanel


Related Posts Plugin for WordPress, Blogger...