Thursday, December 27, 2012

Setting jQuery Star Rating value when loading a page

This is an extension post for How to use jQuery star rating in JSF2
This post show how to set the Star Rating value when page loading.
It's also applicable for retrieving Star Rating value from database.

Managed Bean
1. Declared a value holder, in session scope managedBean.
managedBean property to hold rating value

Wednesday, December 26, 2012

Adding jQuery capabilities into JSF2

jQuery is very popular in these days. Some of the advanced JSF2 implementations are bundled the jQuery together. But, for the native JSF2 implementation (Sun or Myfaces) is not.

Thus, if you are using the native JSF2 implementation, and wish to use the jQuery in the application, the jQuery library can be added manually with the following steps.

How to integrate Liferay with OpenOffice for document conversion

The objective is to enable document conversion in Liferay with OpenOffice.
with this approach, there are no effort from developers for document conversion. ONLY configuration.

Liferay 6.1.1
OpenOffice 3.4
OS - Windows 7

1. Start OpenOffice as a listening service
    a. navigate to the <OpenOffice_installation_directory>/program
    b. execute the following command in command prompt
        soffice -headless -accept="socket,host=,port=8100;urp;" -nofirststartwizard 

Saturday, December 22, 2012

Thursday, December 20, 2012

submenu with Richfaces contextMenu

From the Richfaces contextMenu Demo, we can see that a popup menu on an event on the target component. eg, click event, hover event, etc.
sample rich:contextMenu

From the demo, we see only 1-level menu, we can further extend the contextMenu to 2-levels sub menu.
below are the code snippet extending the Richfaces contextMenu Demo

Wednesday, December 19, 2012

rich:menuItem's action not working in Liferay

Recently I found that the richfaces contextMenu is not working properly in Liferay portal.
when I bind an action in <rich:menuItem />, the action is not being invoked.
<rich:contextMenu target="editpic" mode="client" showEvent="click">
    <rich:menuItem lable="item1" action="#{bean.action1}" />
    <rich:menuItem lable="item2" action="#{bean.action2}" />
this is normal contextMenu in a Richfaces application,
But it is not working in Liferay JSF application.

Monday, December 17, 2012

various ways to invoke rich:popupPanel

richfaces popupPanel is a very useful component.
It could hide complex form into popup, when invoke the popup dialog when it is required.

below are various ways to invoke the richfaces popupPanel.

Saturday, December 15, 2012

JPQL IN clause

There are two ways to write IN clause in JPQL

1. conventional way
    Pass in a comma separated String into the query 
    StringBuffer jpql = new StringBuffer();
    jpql.append("SELECT a FROM TABLE_A a");
    jpql.append("WHERE IN (:idList)");
    Query query = entityManager.createQuery(jpql.toString());
    query.setParameter("idList", idList);
        in this case, idList is a comma separated string, eg. "1, 2, 3, 4"

How to generate entities from tables with Eclipse JPA Tools

The purpose of this post is to show detail steps on how to setting up JPA project and generate entities for the JPA Project

Required Software/Tool
1. Eclipse
2. JDBC jar file for the target database

Wednesday, December 12, 2012

How to create new Liferay portlet in existing portlet project

It is possible to create multiple portlet in the same portlet project.
Therefore, all the library and resources, e.g. jars, css, js, etc can be shared among portlet in the same project.

in this post, I will use JSF2 portlet as the sample.
for more information, please refer How to create JSF2 Portlet in Liferay

Saturday, December 8, 2012

How to connect different databases with HSQL client

To connect different databases with HSQL client. this is very useful in a production environment, where a single client (in fact, just a jar file and lightweight) can connect to multiple databases.

1. hsql.jar
2. jdbc driver for the target database.

How to connect Liferay database with HSQL client

To connect Liferay HSQL database, this is useful during development.
at the same time, the HSQL client can be used to connect different database servers.

1. locate hsql.jar in <LIFERAY_HOME>. (the hsql.jar may be located in different location for different application server package).
2. d-click on the hsql.jar to launch the HSQL client.
3. Fill in the name and url as jdbc:hsqldb:file:<LIFERAY_HOME>/data/hsql/lportal
4. click ok.

Thursday, December 6, 2012

How to switch EJB client to local or remote interface without changing code

purpose of this post is to show the design of EJB client that is allowed to switch to @Local or @Remote easily without changing codes.

1. Create a java interface with all the method signatures. eg. IFooService
2. Create an empty java interface that extends IFooService and annotate it as @Local. eg. ILocalFooService.
3. Create an empty java interface that extends IFooService and annotate it as @Remote. eg. IRemoteFooService
4. Create the implementation class that implements both ILocalFooService and IRemoteFooService, eg. FooService.

Monday, December 3, 2012

Mounting / integrating Alfresco repository in Liferay

Liferay is the universal portal for its' users.
Liferay provides good mechanism to integrate with Alfresco.
This allowed Liferay users to browse their Alfresco repository presented with portlet without opening the Alfresco in another browser window and enter the username/password to login to Alfresco again.

1. Liferay CE 6.1.1
2. Alfresco 4.2.x


Saturday, December 1, 2012

How to install jQuery plugin in JSF2

The purpose of this post is to show how to install additional jQuery plugins into Richfaces application.
Before start the post, you may take a look on Adding jQuery capabilities into JSF2 and How to verify jQuery in Richfaces 4 is working

How to verify jQuery in Richfaces 4 is working

The purpose of this post is to verify that the jQuery bundled in Richfaces is working.

1. Add the following script into the page
2. add the following line of code into the page.
3. make sure <h:head /> in the page. it must be <h:head /> instead of the html <head />, so that Richfaces is dynamically adding the required script files into the page.
4. add at least 1 Richfaces component into the page to ensure Richfaces scripts are loaded into the page.


Related Posts Plugin for WordPress, Blogger...