Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to use applet with portlet in liferay?

    • 0
    • 1
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 755
    Comment on it

    Hello Guys
    Below code will help you to build java applet in liferay portlet.

    Write below code in view.jsp :

    <applet name="Demo" id="Demo" code="com.AppletDemo" codebase='<%= themeDisplay.getCDNBaseURL()+"/PortletName" %>' width="450"  height="300">
        <param name="jnlp_href" value="AppletDemo.jnlp" />
         <param name="separate_jvm" value="true" />

    Create JNLP file for define jar file:

    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+" codebase="" href="AppletDemo.jnlp">
        <homepage href=""/>
        <description kind="short">AppletDemo</description>
    <update check="timeout" policy="prompt-update"/>
            <j2se version="1.6+"/>
            <jar href="AppletDemo.jar" main="true"/>
            <jar href="Other-jar-files.jar"/>

    Now write applet in

    package com;
    import javax.swing.JApplet;
    import javax.swing.JLabel;
    import java.awt.Font;
    public class AppletDemo extends JApplet {
         * Create the applet.
        public AppletDemo() {
            JLabel lblNewLabel = new JLabel("Hello Bhagwan");
            lblNewLabel.setFont(new Font("SansSerif", Font.PLAIN, 18));
            lblNewLabel.setBounds(114, 78, 130, 51);

    Thank you.

 1 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: