Wednesday, November 18, 2009

Import the lar file for the guest community.

Enable the below property in portal-ext.properties to import the lar file for the guest community.

#
# Specify a LAR file that can be used to create the guest public layouts.
# If this property is set, the previous layout properties will be ignored.
#
default.guest.public.layouts.lar=${liferay.home}/deploy/default_guest_public.lar

SignOut Message in .vm File

Step: 1
Add the below lines in LogoutAction.java
after session.invalidate();
HttpSession logoutSession = request.getSession();
logoutSession.setAttribute("logoutSession", logoutSession);


Step: 2

create EXTServicePreAction.java under (com.liferay.portal.events.EXTServicePreAction.java )


EXTServicePreAction.java

package com.liferay.portal.events;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.liferay.portal.kernel.events.Action;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.util.WebKeys;

public class EXTServicePreAction extends Action {


public void run(HttpServletRequest req, HttpServletResponse res)
throws ActionException {
Map vmVariables = new HashMap();
HttpSession session = req.getSession();
HttpSession logoutSession = null;
logoutSession = (HttpSession)session.getAttribute("logoutSession");

try {
if(Validator.isNotNull(logoutSession)){
logoutSession.setAttribute("flag", true);
}else{
logoutSession = req.getSession();
logoutSession.setAttribute("flag", false);
}
} catch (Exception ex) {
Logger.getLogger(EXTServicePreAction.class.getName()).log(Level.SEVERE, null, ex);
}
vmVariables.put("logoutSession", logoutSession);

req.setAttribute(WebKeys.VM_VARIABLES, vmVariables);
}
}

step: 3
Add the below line in portal-ext.properties

servlet.service.events.pre=com.liferay.portal.events.ServicePreAction,com.liferay.portal.events.EXTServicePreAction



step: 4

Add the below line in portal_normal.vm

#if ($logoutSession.getAttribute("flag"))
<div>
<b>Successfully Logout</b>
$logoutSession.invalidate()
</div>
#end

Monday, July 27, 2009

liferay performance-tuning

----------------------------------------------------------------
Performance Improvement
----------------------------------------------------------------

a) Memory - garbage collection thru Admin interface

b) Parameters to JVM while starting tomcat
-Xms128m -Xmx1024m -XX:MaxPermSize=128m

c) DBCP instances - increase it in ROOT.xml

d) Properties file changes
last.modified.check=false
theme.css.fast.load=true
javascript.fast.load=true

e) Servlet Filters

Total of 15 filters. Disable the ones that are not required. eg.

CompressionFilter
StripFilter

Open web.xml and comment the entries for these filters.

Similarly for,

CASFilter
NtlmFilter
VirtualHostFilter

The fewer servlet filters you are running, the less processing power is needed.

f) Portlet

Edit the following files to disable certain portlets from getting deployed to the portal server.

portlet.xml
liferay-portlet.xml

Restart the server

g) Database design

Ensure all the search colums are indiced properly.
Do periodic house-keeping on the database indices.
Proper design of the database tables keeping in mind the normalization techniques.

h) Get the cache-ing enabled for database objects.

By default only the User_ table is cached. Cache other tables as well that will be frequenly accessed.

Refer to the place where you can do this setting.

i) Application Layer

Write your code in such a way that you make lesser database / hibernate calls.

Remember, every call to the persistence layer is going to take time. So be very careful using them. Never use persistence layer calls inside loops.

Write optimized queries when you put them in custom-sql files.

j) UI design

place fewer portlets on a portal page.

when you use images / flash objects make sure that they are very small.

If you write custom css / javascript compress them using YUI compressor so that they get downloaded to the browser pretty fast.

Replace Tinymce in the place of FCKEditor.

k) Setting logging mode to ERROR.

liferay-clustering

Running Liferay in a clustered environment consists of 6 steps.

1. Preparations and getting things ready.
2. Connecting to a remote MySQL database.
3. Running 2 or More "IDENTICAL" Liferay tomcat instances on 2 Or more physical machines.
4. Making one machine as "Apache Web Server"
5. Connecting apache with tomcat using apache module "mod_jk"
6. Configuring mod_jk for clustering for both load-balancing and fail-over.
7. Verifying whether clustering is working fine.

=================================================================================

1. Preparations and getting things ready.

Select 4 physical machines (servers) in your LAN network. Each should have an internal IP address.

Just ping between the 4 machines and confirm that the pinging is successful.

Make sure none of the machines have fire wall running.

1 machine we'll use as Database server (Either windows or Linux) on which MySQL is installed and running
2 machines will be made as clustered servers on which identical verions of liferay is up running.
1 machine will be the apache http server which will be exposed to the outside world. Let this be a windows machine.
In the later part of this exercise we'll see how to run apache on a Linux server.

Note down the IP address of IP addresses of all four machines.

Machine 1 (MySQL) - [IP Address 1]
Machine 2-a (Liferay 1) - [IP Address 2]
Machine 2-b (Liferay 2) - [IP Address 3]
Machine 3 (Apache server with mod_jk) [IP Address 4]

----------------------------------------------------------------------------------------------
2. Connecting to a remote MySQL database.
----------------------------------------------------------------------------------------------

On the machine where mysql is running, open mysql prompt by typing "mysql -u root -proot mysql" from the command window.

Run these following scripts. Before running dont forget to modify the [IP Address X].

create database lportal2 character set utf8;

-- Giving access to the first Liferay machine (2-a)
---------------------------------------------------

insert into db (
Host
,Db
,User
,Select_priv
,Insert_priv
,Update_priv
,Delete_priv
,Create_priv
,Drop_priv
,Grant_priv
,References_priv
,Index_priv
,Alter_priv
,Create_tmp_table_priv
,Lock_tables_priv
,Create_view_priv
,Show_view_priv
,Create_routine_priv
,Alter_routine_priv
,Execute_priv
)
values (
"[IP Address 2]"
,"lportal2"
,"root"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"N"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"N"
,"N"
);

GRANT ALL ON lportal2.* TO root@'[IP Address 2]' IDENTIFIED BY 'root';

-- Giving access to the second Liferay machine (2-b)
-- --------------------------------------------------

insert into db (
Host
,Db
,User
,Select_priv
,Insert_priv
,Update_priv
,Delete_priv
,Create_priv
,Drop_priv
,Grant_priv
,References_priv
,Index_priv
,Alter_priv
,Create_tmp_table_priv
,Lock_tables_priv
,Create_view_priv
,Show_view_priv
,Create_routine_priv
,Alter_routine_priv
,Execute_priv
)
values (
"[IP Address 3]"
,"lportal2"
,"root"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"N"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"Y"
,"N"
,"N"
);

GRANT ALL ON lportal2.* TO root@'[IP Address 3]' IDENTIFIED BY 'root';

Important:

Once you have run the above scripts, pls dont forget to restart your MySQL.

Verification:

Now open the command window in the 2 machines where liferay is running and enter the command,

mysql -h [IP Address 1] -u root -proot lportal2;

This should successully get entry to the mysql prompt.

Do the similar thing on the other machine where Liferay is running and confirm that is it also connecting to
the remote Mysql database server.

Tags and Asset Publisher

1.Tags
=======

Go to the Admin page in the Guest Community.
Add the Tags Admin portlet to the page.
Under Add Tag, type dog and add a new category named Animals.
Add another tag named tom add a new category named Friends.
Add a third tag named jane to the Friends category.

First, we will tag a journal article with the dog tag.
Go to the CMS page and click Articles.
We will create an article containing a Haiku about dogs.
After clicking Add Article you are taken to the Edit page.
On the right of the Body Box there is a section labeled Categorization. In that box click Select
Tags.
Select the tag dog, and save. Once you have added your Haiku, click Save and Approve

As Administrator, create a page named Links and place the bookmarks portlet on it.
Click Add Folder and create a folder named Fun Links and open the folder to add a
Bookmark.
We will use the Wikipedia page for dogs as a link. Name the link Dog Wiki, and set the URL
as http://en.wikipedia.org/wiki/Dog.
Click Select Tags and choose
the tag dog.
Click Save when finished


=========================================================================================
2.Asset Publisher
==============

Create a new page under CMS named CMS Article 2.
Change the layout to 50/50 Two Column.
Add two Asset Publisher Portlets to the page, one to each side. Your page should look like
this:
By default the portlet displays all kinds of content. We will change that


Click the Configuration icon on the Asset
Publisher in the left column.
In the Query Logic tab, select tags by the
Animals category, then save.
Click the Display Settings tab, and set the
Display Style to Full Content. Click Save
and return to the full page.
The left Asset Publisher now looks like this:


Now click the Configuration icon on the right Asset Publisher portlet.
Under Query Logic set it so the displayed content must contain the tag jane.
In the Display Settings tab, once again set the Display Style to Full Content. Click Save, and
return to the full page.
Now you should have the haiku, picture, and bookmark on the left, and the picture on the
right.
Click the Configuration icon on the left Asset Publisher.
Under Query Logic set it so the displayed content must NOT include the tag tom, and click
Save.

CMS Utility portlet

CMS Utility portlet
=======================
Breadcrumb

Navigation Portlet

Sitemap

Journal content search

Web proxy

RSS portlet

weather

stocks

Tuesday, July 21, 2009

Creating a new Theme

In the $PLUGINS_SDK/themes folder run:


ant -Dtheme.name=newtheme -Dtheme.display.name="My New Theme" create



"newtheme" will be the theme name we would like to give.


"My New Theme" will the display name of our theme.


Navigate to the newly created $PLUGINS_SDK/themes/newtheme/_diffs and add some customizations to the default theme.


After this, In the $PLUGINS_SDK/themes folder run:


ant war


The war file of our theme will be created in the $PLUGINS_SDK/themes/dist .

Now deploy this war file.

You can go to your deploy (webapps) directory and see the new theme folder being created there.

Once your theme has been deployed, and you're ready to modify the CSS, use the custom.css file to change and override the default styling, leaving all of the other CSS files alone. You can modify any of the javascript files, image files, and template files, but the CSS changes should be restricted to custom.css.


Once you're done modifying your files, you must place them in your _diffs directory with the same directory structure as the actual theme.we'll assume that you've modified the custom.css file, an image file in the dock, and two template


files: portal_normal.vm and portlet.vm. With those files, your _diffs directory would look like this:


plugins/themes/newtheme/


_diffs/

css/

custom.css

images/

dock/

menu_bar.png

templates/

portal_normal.vm

portlet.vm

The order in which your theme is built goes something like this:


It creates the directory and adds the appropriate build files, and XML files needed. It then copies all of the files from the _unstyled/ directory, and after that, the files from _styled/ are copied over, and the last step is that your files in the _diffs directory are copied over. So this means you will place all of your new files and changed files into the _diffs directory.


Color Schemes


In your liferay-look-and-feel.xml (located in WEB-INF), you would specify the class names like so:



<theme id="my_theme" name="My Theme">

<root-path>/my_theme</root-path>

<templates-path>${root-path}/templates</templates-path>

<images-path>${root-path}/images</images-path>

<template-extension>vm</template-extension>

<color-scheme id="01" name="Blue">

<css-class>blue</css-class>

<color-scheme-images-path>${images-path}/color_schemes/${css-class}</color-scheme-images-path>

</color-scheme>

<color-scheme id="02" name="Green">

<css-class>green</css-class>

</color-scheme>

</theme>


The way you would style your different color schemes is like so:


Inside of your css directory, create a folder called "color_schemes". Inside of that directory, place a css file for each of your color schemes. In the case above, we would could either have just one called green.css and let the default styling handle the first color scheme, or you could have both blue.css and green.css.


Now, inside of your custom.css, you would place the following lines:


@import url(color_schemes/blue.css);

@import url(color_schemes/green.css);

The way you would identify the styling for the css is this way: In blue.css you would prefix all of your css styles like this:


.blue a {color: #06C;}

.blue h1 {border-bottom: 1px solid #06C}


And in green.css you would prefix all of your css styles like this:

.green a {color: #0C6;}

.green h1 {border-bottom: 1px solid #0C6}


Customization of CSS

Here are the descriptions for each of the CSS files:


main.css

this file includes all of the other css files. This file can be edited, but probably should not be.

custom.css

This file is where the developer should place all of their css that is different from the other files, unless they are not concerned about upgrading their theme later on. By placing their custom CSS in this file, and not touching the other files, they can be assured that the upgrading of their theme later on will be much smoother.


base.css

This file contains all of the base styling that is fairly generic, such as the styling for all elements not directly related to another aspect of the site, such as the forms or navigation or dock.


forms.css

This file contains all css styling related to form elements on the page.


layout.css

This file contains all of the styling related to the layouts. It is fairly low level, and should most likely not be edited, unless there is something specific they need.


navigation.css

This file contains all of the styling related to the navigation, as well as the dock.


portlet.css

This file contains all of the styling related to the portlets, including the JSR-168 class-names.


tabs.css

This file includes all of the styling related to the tabs in the portlets.


deprecated.css

This file contains styles that are deprecated, but included for compatibility. It can most likely be safely ignored.



Use the custom.css file to change and override the default styling, leaving all of the other CSS files alone. You can modify any of the javascript files, image files, and template files, but the CSS changes should be restricted to custom.css.


For example the body background color is defined in base.css as follows:


body {



background-color: #fff;



}


in the above example the background color used is white ,and if would like to change the color to say black then write the below css in custom.css:


body {



background-color: #000;

}


Similarly we can change the default css by rewriting them in custom.css


Templates:


Here are the descriptions for each of the templates:

portal_normal.vm

this file contains the overall site structure, from opening HTML tag to closing. It includes the header, and footer, and includes the two templates (i.e., dock.vm and navigation.vm) and it also includes the system files needed by the liferay core


dock.vm

this file contains all of the HTML for the dock.


navigation.vm

this file contains all of the html for the navigation


portal_pop_up.vm

this file contains the entire html structure for popup windows.


portlet.vm

this file contains the HTML that wraps every portlet, including the portlet title and portlet-icons.


Customization of templates:

Example portal_normal.vm

If we want the dock to appear only when the user is signed in then the following changes have to be made in portal_normal.vm


Replace the following code


#parse ("$full_templates_path/dock.vm")



with

#if ($themeDisplay.isSignedIn())




#parse ("$full_templates_path/dock.vm")




#end

Spring Portlet

Step 1:



create a dummy JSP portlet to begin with by using the following command



create.bat weather "Weather Spring Portlet"


================================================================



Step 2:


create a folder "context" under "/docroot/WEB-INF"



create file "weather-portlet.xml" under "context"



<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "../../dtd/spring-beans.dtd">

<beans>



<bean id="weatherService" class="com.sample.weather.WeatherServiceImpl" />

<bean id="weatherController" class="com.sample.weather.WeatherController">

<property name="weatherService" ref="weatherService" />

</bean>

<bean class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">

<property name="portletModeMap">

<map>

<entry key="view" value-ref="weatherController" />

</map>

</property>

</bean>

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">

<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />

<property name="prefix" value="/jsp/" />

<property name="suffix" value=".jsp" />

</bean>

</beans>



================================================================



Step 3:



create file "application.xml" under "context"



<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "../dtd/spring-beans.dtd">



<beans>

<bean id="weatherService" class="com.sample.weather.WeatherServiceImpl" />

<!-- Default View Resolver -->

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">

<property name="cache" value="false"/>

<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>

<property name="prefix" value="/jsp/"/>

<property name="suffix" value=".jsp"/>

</bean>

</beans>



================================================================



Step 4:


create file "view.jsp" docroot/jsp



<%@ page contentType="text/html" isELIgnored="false" %>


<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>



<table border="1">

<tr>

<th>City</th>

<th>Temperature</th>

</tr>

<c:forEach items="${temperatures}" var="temperature">

<tr>

<td>${temperature.key}</td>

<td>${temperature.value} </td>

</tr>

</c:forEach>

</table>



================================================================



Step 5:


create file WeatherController.java under /docroot/WEB-INF/src/com/sample/weather



package com.sample.weather;



import javax.portlet.RenderRequest;

import javax.portlet.RenderResponse;

import org.springframework.web.portlet.ModelAndView;

import org.springframework.web.portlet.mvc.AbstractController;



public class WeatherController extends AbstractController {

private WeatherService weatherService;

public void setWeatherService(WeatherService weatherService) {

this.weatherService = weatherService;

}

public ModelAndView handleRenderRequestInternal(

RenderRequest request, RenderResponse response) throws Exception {

return new ModelAndView("view","temperatures", weatherService.getMajorCityTemperatures());

}

}



================================================================



Step 6:


create the interface WeatherService.java under /docroot/WEB-INF/src/com/sample/weather




package com.sample.weather;



import java.util.Map;

public interface WeatherService {

public Map<String, String> getMajorCityTemperatures();

}



================================================================



Step 7:



create the implementation WeatherServiceImpl.java under /docroot/WEB-INF/src/com/sample/weather



package com.sample.weather;



import java.util.HashMap;

import java.util.Map;



public class WeatherServiceImpl implements WeatherService {

public Map<String, String > getMajorCityTemperatures() {

Map<String, String > temperatures = new HashMap<String, String>();

temperatures.put("New York", "6.0");

temperatures.put("London", "10.0");

temperatures.put("Singapore", "5.0");

return temperatures;

}

}



Step 8:



Modify portlet.xml file



replace,



<portlet-class>com.sample.jsp.portlet.JSPPortlet</portlet-class>



with,



<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>



-------------------------



replace,



<init-param>

<name>view-jsp</name>

<value>/view.jsp</value>

</init-param>



with,



<init-param>

<name>contextConfigLocation</name>

<value>/WEB-INF/context/weather-portlet.xml</value>

</init-param>



----------------------------



insert



<portlet-mode>view</portlet-mode>

<portlet-mode>help</portlet-mode>



inside,



<supports> elements



================================================================



Step 8:



(insert the below contents into web.xml)



<display-name>Weather Portlet based on Spring</display-name>



<context-param>

<param-name>webAppRootKey</param-name>

<param-value>com.sample.weather</param-value>

</context-param>



<context-param>

<param-name>log4jConfigLocation</param-name>

<param-value>/WEB-INF/classes/log4j.properties</param-value>

</context-param>



<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/context/application.xml</param-value>

</context-param>



<listener>

<listener-class>org.springframework.web.util.WebAppRootListener</listener-class>

</listener>



<listener>

<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>

</listener>



<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>



<servlet>

<servlet-name>ViewRendererServlet</servlet-name>

<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>



<servlet-mapping>

<servlet-name>ViewRendererServlet</servlet-name>

<url-pattern>/WEB-INF/servlet/view</url-pattern>

</servlet-mapping>




================================================================



Step 9:



Copy the contents of "lib" folder to "WEB-INF/lib"

Monday, July 20, 2009

Email Validation

<script type="text/javascript">



function email(str) {



var at="@"

var dot="."

var lat=str.indexOf(at)

var lstr=str.length

var ldot=str.indexOf(dot)

if (str.indexOf(at)==-1){

alert("Invalid E-mail ID")

return false

}



if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

alert("Invalid E-mail ID")

return false

}



if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

alert("Invalid E-mail ID")

return false

}



if (str.indexOf(at,(lat+1))!=-1){

alert("Invalid E-mail ID")

return false

}



if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

alert("Invalid E-mail ID")

return false

}



if (str.indexOf(dot,(lat+2))==-1){

alert("Invalid E-mail ID")

return false

}



if (str.indexOf(" ")!=-1){

alert("Invalid E-mail ID")

return false

}



return true

}






</script>

Simple Struts Portlet

1) portlet-ext.xml

--------------------



<portlet>

<portlet-name>EXT_3</portlet-name>

<display-name>Library Portlet</display-name>

<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>

<init-param>

<name>view-action</name>

<value>/ext/library/view</value>

</init-param>

<expiration-cache>0</expiration-cache>

<supports>

<mime-type>text/html</mime-type>

</supports>

<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>

<security-role-ref>

<role-name>power-user</role-name>

</security-role-ref>

<security-role-ref>

<role-name>user</role-name>

</security-role-ref>

</portlet>







2) liferay-portlet-ext.xml

----------------------------



<portlet>

<portlet-name>EXT_3</portlet-name>

<struts-path>ext/library</struts-path>

<use-default-template>false</use-default-template>

</portlet>







3) liferay-display.xml

------------------------



add



<portlet id="EXT_3" />



inside



<category name="category.example">






4) struts-config.xml

----------------------



<action path="/ext/library/view" forward="portlet.ext.library.view" />



5) tiles-defs.xml

-------------------



<definition name="portlet.ext.library" extends="portlet" />

<definition name="portlet.ext.library.view" extends="portlet.ext.library">

<put name="portlet_content" value="/portlet/ext/library/view.jsp" />

</definition>





(create the following two jsp files under "/ext/ext-web/docroot/html/portlet/ext/library")



6. init.jsp

-------------



<%@ include file="/html/portlet/init.jsp" %>

Add commonly used variables and declarations here!





7. view.jsp

-------------



<%@ include file="/html/portlet/ext/library/init.jsp" %>

Simple Struts Portlet!



8 Language-ext.properties

---------------------------



Add a new entry in the above file,



javax.portlet.title.EXT_3=Library Portlet

Basic JSP Portlet

1.Basic JSP Portlet

~~~~~~~~~~~~~~~~~~~

[the xml files are located under "ext/ext-web/docroot/WEB-INF"]


1.1. portlet-ext.xml

--------------------


(insert the below content)


<portlet>

<portlet-name>EXT_2</portlet-name>

<display-name>JSP Portlet Introduction</display-name>

<portlet-class>com.liferay.util.bridges.jsp.JSPPortlet</portlet-class>

<init-param>

<name>view-jsp</name>

<value>/html/portlet/ext/jsp_portlet/view.jsp </value>

</init-param>

<expiration-cache>0</expiration-cache>

<supports>

<mime-type>text/html</mime-type>

</supports>

<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>

<security-role-ref>

<role-name>power-user </role-name>

</security-role-ref>

<security-role-ref>

<role-name>user</role-name>

</security-role-ref>

</portlet>



1.2. liferay-portlet-ext.xml

----------------------------



(insert the below content)



<portlet>

<portlet-name>EXT_2</portlet-name>

</portlet>



1.3. liferay-display.xml

------------------------



(insert the below content)



<category name="category.example">

<portlet id="EXT_2">

</category>



1.4. view.jsp

-------------



(create this file under "ext/ext-web/docroot/html/portlet/ext/jsp_portlet"

and enter the below contents)



Welcome to simple Basic JSP Portlet



Note: after this step do "ant deploy" from "ext-web"



1.5 Language-ext.properties

---------------------------



(under /ext/ext-impl/src/content)



Add two new entries in the above file,



javax.portlet.title.EXT_2=JSP Portlet



category.example=Example



Note: after this step do "ant deploy" from "ext-impl"

Writing Dynamic Query using Hibernate API's

1:
=======
in AddBookAction.java:

if (Validator.isNull(cmd)) {
BookLocalServiceUtil.create(bookTitle);
} else {
List results = null;
if (cmd.equals("find")) {
results = BookLocalServiceUtil.findBooks(bookTitle);
} else {
DetachedCriteria dCriteria = DetachedCriteria.forClass(Book.class);
dCriteria.add(Restrictions.like("title", "%" + bookTitle + "%"));
DynamicQuery dynamicQuery = new DynamicQueryImpl(dCriteria);
results = (List)BookLocalServiceUtil.dynamicQuery(dynamicQuery);
}
req.setAttribute("results", results);
req.setAttribute("cmd", cmd);
}

2:
=======
in view.jsp

Add for 'search' button

<input value="Search" onclick="" type="button">findBook('search');" />

Note: the findBook JS function is now accepting a parameter, do changes to this function and also to the "Find Book" button.

3:
=======

in Success.jsp update this

if (Validator.isNotNull(cmd)) {
books = (List)request.getAttribute("results");
} else {
books = BookLocalServiceUtil.getAllBooks();
}

4 :
========
ant deploy from ext-impl,
ant deploy from ext-web,
restart tomcat

Websites Developed by Liferay


http://www.paninicomics.it/web/guest/home
http://www.connexion.sg/web/guest/home
http://www.axxonet.net/web/guest/home
http://www.myoffice24x7.com/web/guest/home
http://www.mathforamerica.org/home
http://www.myjv.com/web/public/home
http://www.b-informed.de/web/guest/yapta
http://www.toyotahitel.hu/finanszirozas
http://www.afromix.info/web/news/
http://www.k4k.hu/nyitolap
http://www.euroleasing.hu/index
http://www.unisalento.it/web/guest/home_page
http://www.mebtel.net/pub/guest/home
http://www.netbiscuits.com/home
http://www.betavine.net/bvportal/home.html
http://www.kokkolaweather.fi/web/guest/home
http://www.ruralpovertyportal.org/web/guest/home
http://www.casagrandeaz.gov/web/guest/home
http://www.orshalom.org/web/guest/home
http://www.ntk.hu/web/guest/home
http://www.jsonlive.com/web/guest/jsonhome
http://www.soapractice.com/web/guest/home
http://207.210.217.14/web/guest/home
http://www.cise09.org/web/guest/home
http://www.xml-intl.com/web/guest/home
http://www.youthpeer.org/web/guest/home
https://teaming.dss.state.la.us/web/guest/home
http://p-learnet.univ-lille1.fr/web/guest/home
http://nfig.hd.free.fr/web/guest/home
http://www.lingresource.com/web/guest/home
http://www.skillsconnect.gov.sg/web/guest/home
http://developer.tandberg.com/web/guest/home
http://pennstatehershey.org/web/guest/home
http://learninglab.etwinning.net/web/guest/home
http://apps.zanox.com/web/guest/home
http://www.idmunit.org/web/guest/home
http://www.amishitayal.com/web/guest/home
http://www.benetton.com/portal/web/guest/home
http://www.centurioncargo.com/web/guest/home
http://www.sidsa.com/web/guest/home
http://www.icareus.com/web/guest/home
http://www.mybizsites.com/web/guest/home
http://ac.utm.my/web/guest/main
http://www.techweb.com/web/guest/home
http://www.mypic32.com/web/guest/home
http://gmoss.jrc.it/web/guest/home
http://www.nimbleartists.com/web/guest/home
https://www.skywayperspectives.org/portal/web/guest/home
http://www.nimbleartists.com/web/guest/home
http://wi2bc8.bwl.uni-mannheim.de/web/guest/home
http://www.ignouforum.com/web/guest/home
http://www.newedgegroup.com/web/guest/home
http://www.geoportal.org/web/guest/home
http://suhakam.org.my/web/guest/home
http://www.etiagarwal.com/web/guest/home
http://www.bankrakyat.com.my/web/guest/home
http://www.in4ama.org/web/guest/home
http://www.vivektayal.com/web/guest/home
http://www.uengine.org/web/guest/home
http://www.mdks.gov.my/web/guest/home
http://www.apolytrosis.gr/web/guest/home
http://einstein.mangala-server.com/liferay/web/guest/home