Skip to main content

2 posts tagged with "Liferay"

View All Tags

Usage of LanguageUtil class in Liferay

· One min read
Sandeep Bhardwaj

For fetching properties based on locale from properties file in liferay is easy. Use get() method of com.liferay.portal.kernel.language.LanguageUtil class of liferay. It will automatically pick the correct locale file and return the property value.

There are 6 overloaded get methods in LanguageUtil class.

get(Locale locale, String key): StringLanguageUtil  
get(Locale locale, String key, String defaultValue) StringLanguageUtil
get(PageContext pageContext, String key) StringLanguageUtil
get(PageContext pageContext, String key, String defaultValue) StringLanguageUtil
get(PortletConfig portletConfig, Locale locale, String key) StringLanguageUtil
get(PortletConfig portletConfig, Locale locale, String key, String defaultValue) StringLanguageUtil

Usage

<%@page import="com.liferay.portal.kernel.language.LanguageUtil"%>  
<%
String propertyValue=LanguageUtil.get(pageContext, "property_name", new String("NOT_FOUND"));
%>

Argument of get method :-

1st: page context.
2nd: property name whose value to be fetched.
3rd: default value return by get method, if property not found.

Un Deploy Ext plugin in liferay

· One min read
Sandeep Bhardwaj

Un Deploy Ext Plugin in Lifeay 6.0

Un deployment of ext plugin in liferay is a tricky task, so i found a simple solution for doing this instead of deleting all the ext files from tomcat. I made a bat file for this this bat file remove all the ext plugin related files from your tomcat directory.

@echo off  
set app_name=%1
if "%app_name%" == "" goto end
set tomcat_home=<Your tomcat home direcory>

rmdir /S /Q %tomcat_home%\temp
rmdir /S /Q %tomcat_home%\webapps\%app_name%-ext
rmdir /S /Q %tomcat_home%\webapps\ROOT\html\portlet\ext
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\classes\portal-ext.properties
del /S /Q %tomcat_home%\lib\ext\ext-%app_name%-ext-service.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-util-bridges.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-util-taglib.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-util-java.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\lib\ext-%app_name%-ext-impl.jar
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\ext-%app_name%-ext.xml
del /S /Q %tomcat_home%\webapps\ROOT\WEB-INF\tiles-defs-ext.xml

:end

just change the tomcat_home with your tomcat home directory and paste the code in a notepad and save as undeployment.bat .
For running the bat pass your ext application name (with our ext) as command line argument.

C:/>undeployment.bat <application name>