This tutorial will explains about showing up applet in Liferay portlet.

Challenges for applet integration:

  • HTML5 doesn’t support <applet> tag any more and supports embedded and object tags only.
  • Java7 imposed restrictions on applet security. In windows,  you can modify the java security settings at controlpanel->Java->security tab-> select medium.
  • Applets must be signed with security certificates to load in browser
  • Ensure Chrome, IE and Firefox browsers are enabled with Java Runtime. If your system is java 64 bit, installed browsers are 32 bit then applets will not run in these.  If java 32 bit installed in your machine then your browser must be 32 bit  and vice versa.

Liferay Portlet integration with applets:

    •  Create a directory structure as shown in below
    • The tricky question you get here is, where to copy  applet project jar file? In this tutorial, I have created “sampleApplet.jar” file. You can not put this jar inside “lib” folder.
    •   Applet tag doesn’t support in HTML5 browsers. The recommended approach would be to use  <jsp:plugin> tag to embed applet in jsp page.
      • In view.jsp, add the below JSP code:
        %@ page import=”javax.portlet.*”%>
        <%@ page import=”com.liferay.portal.util.PortalUtil” %>
        <%@ taglib uri=”http://java.sun.com/portlet_2_0″ prefix=”portlet”%>
        <portlet:defineObjects /><jsp:plugin type=”applet” code=”com.test.applet.SampleApplet.class” width=”1000″
        height=”800″ codebase=”/{portlet-name}/applets” archive=”sampleApplet.jar” >
        <jsp:params>
        <jsp:param name=”country” value=”UK” />
        <jsp:param name=”languge” value=”en” />
        <jsp:param name=”format” value=”text” />
        <jsp:param name=”targetFile” value=”1.0″ />
        </jsp:params>
        <jsp:fallback>
        <p>Unable to load applet</p>
        </jsp:fallback>
        </jsp:plugin>
    • Make sure that  “applets” folder must be created  under docroot and  “sampleApplet.jar” exists in that.

 

 

2 Comments

  1. Phan Toan

    please tell me, can i use applet inside liferay 7?

    Reply
    1. Phan Toan

      and if yes, how to use?

      Reply

Leave a Comment

Your email address will not be published. Required fields are marked *