You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Leila Homaeian <le...@ece.ualberta.ca> on 2006/05/28 22:21:45 UTC

Applet in Portlet

Hello,

I am using Jetspeed 2 and Apache Tomcat/5.5.12.
I have been trying to embed an applet to a portlet. I have tried many
alternatives but no success. My portal is under demo/ directory. and the
path to my applet is:

demo/WEB-INF/classes/org/apache/jetspeed/portlet/helloworld/myapplet.class
(my portlet called HelloWorld is located in the same directory as the
applet)
and the path to my .jsp file is:
demo/WEB-INF/hello.jsp

I am using Maven 1.0.2 to build my .WAR file.

I am not sure how to set the value of the codebase tag. I
have tried the following settings in my .jsp file: (response and request
refer to RenderResponse and RenderRequest from the doView method,
respectively.)

<applet border="0" align="top" height="195" width="152"
code="org.apache.jetspeed.portlet.helloworld.myapplet" codebase='<%=
response.encodeURL(request.getContextPath())%>'>
<param name="type" value="application/x-java-applet">
</applet>

<applet border="0" align="top" height="195" width="152"
code="org.apache.jetspeed.portlet.helloworld.myapplet" codebase='<%=
response.encodeURL("/WEB-INF/classes")%>' >
<param name="type" value="application/x-java-applet">
</applet>

When I run my portal (by viewing 
http://siffleur.cs.ualberta.ca:8891/jetspeed/portal),
it says it cannot find "org.apache.jetspeed.portlet.helloworld.myapplet"
class file. I even tried to jar my applet code, put it in Maven
repository, and use it my .jsp file as follows:

<%@ page import="myapp.myapplet" %>
<applet border="0" align="top" height="295" width="252"
archive="myapplet-1.jar" code="myapp.myapplet">
<param name="type" value="application/x-java-applet">
</applet>

But it still says that the applet class file is not found.

This is my applet code, if it helps:
-----------------------------------------------
package org.apache.jetspeed.portlet.helloworld;
import java.applet.Applet;
import java.awt.Graphics;
public class myapplet extends Applet{
    public void init() {
        System.out.println("Applet initializing");
    }
    public void paint(Graphics g) {
        g.drawString("Your applet is running", 5, 10);
    }
}
----------------------------------------------
I should say that I am not referring to the applet in my doView method at
all. Do you have any idea what is wrong? I'd appreciate any help.

Thanks,
Leila




---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org