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.

Steps:
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.

Platform:
Liferay 6.1.1
OpenOffice 3.4
OS - Windows 7

Steps:
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=127.0.0.1,port=8100;urp;" -nofirststartwizard 

Saturday, December 22, 2012

How to use jQuery star rating in JSF2

This post is to show how to use jQuery star rating in JSF2.

for native JSF2 implementation, please perform Adding jQuery capabilities into JSF2.
for Richfaces, make sure jQuery is working by verify jQuery in Richfaces 4 is working

Required software:
1. jQuery star rating plugin

Pre-requisite
1. JSF2/Richfaces application properly setup
2. jQuery plugin working properly in Richfaces 4


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}" />
</rich:contextMenu>
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 a.id 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.

prerequisites:
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.

Steps:
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.

Steps:
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.

Prerequisite:
1. Liferay CE 6.1.1
2. Alfresco 4.2.x

Steps:

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.

Steps:
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.


Sunday, November 25, 2012

Dynamic include with richfaces popupPanel

Scenario:
this post is to show how to dynamically include a page popupPanel when open, and remove the included page when closed.

The purpose to use dynamic include in popupPanel  are to avoid mandatory validation inside the popup, and to reduce the component tree size, thus reduce the network bandwidth.

Steps:
ManagedBean
1. create a placeholder in managedBean.
2. create a addIncludeUrl method in manageBean
3. create a hideIncludeUrl method in managedBean

Saturday, November 24, 2012

How to create first Richfaces 4 application

This post shows how to create a Hello Richfaces 4 application.

before start this tutorial, please refer my previous on how to create a Hello JSF2 application.
or download the complete Hello JSF2 archive and import into Eclipse workspace.

Prerequisite:
1. Richfaces 4 required libraries
2.

Steps:
1. extract the jar files into <HelloJSF2>/WEB-INF/lib
2. open common.xhtml, change the <head> tag to <h:head>. so that the required scripts can be dynamically added into the xhtml pages.
3. declare the richfaces and a4j tag in the page.

How to make sure latter popupPanel appear on top of preceding pupPanel

Scenario:
There might be cases the system requires a popupPanel from another popupPanel.
Sometimes, latter popupPanel may appears below the preceding popupPanel.

Resolution:
in such a situation, always  the z-index of the latter popupPanel higher than the previous popupPanel to ensure the latter popupPanel appears on top of the previous popupPanel.

Wednesday, November 21, 2012

Richfaces popupPanel and fileUpload issue

To display the Richfaces fileUpload component in a popupPanel.

the purpose is to hide the fileUpload component into the popupPanel, to make the page looks simpler. and only invoke the fileUpload component in the popupPanel when it is needed.


Sunday, November 18, 2012

How to create JSF2 Portlet in Liferay

The purpose of this post is to provide an entry level tutorial on how to create JSF2 portlet in Liferay Portal.

Required software / tools:
1. Eclipse (Juno)
2. Liferay Portal 6.1.1 with tomcat bundled
3. Liferay IDE 6.1.1
4. Liferay Plugin sdk 6.1.1

Prerequisites:
1. make sure Liferay development environment is properly setup

How to setup Liferay development environment

The purpose of this post is to provide a simple guideline to setup Liferay development environment with Eclipse.

Required software:
1. Eclipse
2. Liferay Portal with tomcat bundled
3. Liferay IDE
4. Liferay plugins sdk

Thursday, November 15, 2012

How to install JBoss Tools

this post is to show how to install JBoss Tools in Eclipse Juno. as JBoss Tools is an eclipse plugin that provides many convenient tools for java and web development.
for more information about JBoss Tools, please refer https://www.jboss.org/tools.

How to create first JSF2 application

The purpose of this post is to guide newbies to create a Hello application with JSF2.

Below are some of the required tools/software before we start the tutorial.
1. Eclipse
2. JBoss Tool 4.0
3. Tomcat 7 or JBoss 7.1
4. JSF2 api and impl library

After all the prerequisites are installed and ready, we can start creating our Hello JSF2 application.

LinkWithin

Related Posts Plugin for WordPress, Blogger...