Thursday, April 20, 2017

How to query with Pattern / Case insensitive in mongoDB

 This following example is showing how to query the mongoDB with LIKE

BasicDBObject criteria = new BasicDBObject();
List<BasicDBObject> obj = new ArrayList<BasicDBObject>();
if(firstName != null && firstName.length() > 0) {

//            search the firstName field with case sensitive LIKE operator  
    obj.add(new BasicDBObject("firstName", Pattern.compile(firstName));
if(lastName != null && lastName.length() > 0) {

//            search the lastName field with case insensitive LIKE operator
    obj.add(new BasicDBObject("lastName", 
        java.util.regex.Pattern.compile(lastName, Pattern.CASE_INSENSITIVE)));
if(obj != null && obj.size() > 0) {
    criteria.put("$and", obj);            


Tuesday, April 18, 2017

How to run Liferay blade in windows 10

1. download blade.jar from Liferay.

2. open the command prompt, and navigate to the downloaded blade.jar directory.

3. type the following command in the command prompt

java -cp blade.jar com.liferay.blade.cli.blade create -d path/of/the/liferay/module portlet


Wednesday, April 12, 2017

How to get HTML element from PrimeFaces

In some scenarios, we might want to get the HTML element of a PrimeFaces component and process in javascript.
Assume we have a PrimeFaces inputText component like below.

<p:inputText id="address" value="#{myBean.address}" widgetVar="addrWV" />

1. widgetVar


2. #{p:component('compId')}




Related Posts Plugin for WordPress, Blogger...