Saturday, March 29, 2014

How to change fonts in Eclipse

1. Open Preferences dialog
    Window > Preferences

2. Go to Colors and Fonts
    General > Appearance > Colors and Fonts

3. Choose Java > Java Editor Text Font

4. Edit

5. Choose preferred font, size, color

6. OK > OK


Wednesday, March 26, 2014

How to generate styled PDF in Liferay PrimeFaces Portlet with iText

In the previous post,
How to generate PDF in Liferay PrimeFaces Portlet with iText shows how to generate a PDF document, unfortunately, the generated PDF is not able to handle style class.

<!DOCTYPE HTML><html><body>Generate <strong>PDF</strong> Test</body></html>
can be generated without any problem. 

<!DOCTYPE HTML><html><body>Generate <span style='color: red;'>PDF</span> Test</body></html>
is unable to generate the text with red color.

Sunday, March 23, 2014

JSTL namespace in JSF2.x

Remember to use "" instead of "" in JSF2.x

<ui:composition xmlns=""




How to support multiple languages for Portlet category in Liferay

As a CMS, Liferay allows us to deploy our custom portlet, and also define category for the custom portlet.

We can actually define category for all my custom portlets. eg, My Category Name.
Besides, we also can make the custom category name to support multi-languages with resource bundle.


Wednesday, March 12, 2014

java.lang.ClassNotFoundException: com.sun.crypto.provider.SunJCE from [Module "deployment.ROOT.war:main" from Service Module Loader]

Where using Liferay 6.1.1 with JBoss AS 7.1.1, the following exception could be happen.

17:38:10,244 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[jsp]] (http-localhost- Servlet.service() for servlet jsp threw exception: java.lang.ClassNotFoundException: com.sun.crypto.provider.SunJCE from [Module "deployment.ROOT.war:main" from Service Module Loader]
 at org.jboss.modules.ModuleClassLoader.findClass( [jboss-modules.jar:1.1.1.GA]
 at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked( [jboss-modules.jar:1.1.1.GA]
 at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked( [jboss-modules.jar:1.1.1.GA]
 at org.jboss.modules.ConcurrentClassLoader.performLoadClass( [jboss-modules.jar:1.1.1.GA]
 at org.jboss.modules.ConcurrentClassLoader.loadClass( [jboss-modules.jar:1.1.1.GA]

Tuesday, March 4, 2014

How to resolve jQuery conflict in Liferay

In some cases, we need to install jQuery in Liferay especially the custom theme to achieve some UI features.
But that could be conflict with jQuery that come along with custom portlet.
eg, RichFaces portlet, PrimeFaces portlet, IceFaces portlet.

as long as we add the following line of code in Liferay theme,
then the conflict could be resolved.



Sunday, March 2, 2014

How to pass parameters with <a4j:jsFunction />

<a4j:jsFunction /> allowed us to send JSF ajax request with javascript function.

    oncomplete="myJsFunction();" />

<a4j:jsFunction name="myJsFunction" action="#{myBean.jsAction}" />

But the above implementation has a limitation,
where not allowed us pass parameter(s) to #{myBean.jsAction}

This issue could be resolved by adding <a4j:param /> under <a4j:jsFunction />
The <a4j:param /> associates to a property in managed bean, and inject the param value into managed bean before the action being fired.
Thus, the action (#{myBean.jsAction}) can get the param1 value from the getter.


Related Posts Plugin for WordPress, Blogger...