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


Done!!

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.

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

but, 
<!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 "http://java.sun.com/jsp/jstl/core" instead of "http://java.sun.com/jstl/core" in JSF2.x

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core">    

    ................................

</ui:composition>


Done!!

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.

Steps:

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-127.0.0.1-8080-2) 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(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
 at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
 at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
 at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
 at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [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.

jQuery.noConflict(true)


Done!!

Sunday, March 2, 2014

How to pass parameters with <a4j:jsFunction />

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

sample
<a4j:commandButton
    value="TEST"
    action="#{myBean.action}"
    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.

LinkWithin

Related Posts Plugin for WordPress, Blogger...