You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by "Forsyth, Steven A" <st...@hp.com> on 2005/07/14 20:54:29 UTC

Delivering Applets from Portlets

Does anyone have experience successfully deliverying an applet from a
portlet? I have tried the following in MyPortlet.doView but it does not
seem to work

resp.setTitle( getTitle( req ) );

      resp.setContentType( "text/html" );
      PrintWriter writer = resp.getWriter(  );
      
      writer.print( "<APPLET CODE=AppletPortletApplet.class
CODEBASE=\"c:/pluto-1.0.1/rc3/webapps/appletportlet/\" WIDTH=500
HEIGHT=100/>" );

Instead of seeing the applet run I get the square/triangle/circle image
in the drawing area. I also don't see any of the debug messages from my
Applet (e.g. init does not seem to get called) in my Browser's (IE) Java
Console. There are also no error messages in the console.

I know that the applet works cause I can launch it from a pluto hosted
HTML file.

I know that the portlet is OK cause I can change the writer.print
statement to output "Hello World" and I see it.

Any ideas on the best way to get an applet delivered from a portlet?

Steve Forsyth 
Software Design Engineer
Software Global Business Unit
Hewlett-Packard Company

Re: Delivering Applets from Portlets

Posted by "David H. DeWolf" <dd...@apache.org>.
See below:

Forsyth, Steven A wrote:
> Does anyone have experience successfully deliverying an applet from a
> portlet? I have tried the following in MyPortlet.doView but it does not
> seem to work
> 
> resp.setTitle( getTitle( req ) );
> 
>       resp.setContentType( "text/html" );
>       PrintWriter writer = resp.getWriter(  );
>       
>       writer.print( "<APPLET CODE=AppletPortletApplet.class
> CODEBASE=\"c:/pluto-1.0.1/rc3/webapps/appletportlet/\" WIDTH=500
> HEIGHT=100/>" );

In this example you are using an absolute path to a directory on the 
server for your codebase.  What you need is a link to the applet that 
can be served up through the portal/app server.  In this way, your link 
will end up looking very similar to an image that you want to reference 
in a portlet.

renderResponse.encodeURL(renderRequest.getContextPath())

Hope this helps,

David

> 
> Instead of seeing the applet run I get the square/triangle/circle image
> in the drawing area. I also don't see any of the debug messages from my
> Applet (e.g. init does not seem to get called) in my Browser's (IE) Java
> Console. There are also no error messages in the console.
> 
> I know that the applet works cause I can launch it from a pluto hosted
> HTML file.
> 
> I know that the portlet is OK cause I can change the writer.print
> statement to output "Hello World" and I see it.
> 
> Any ideas on the best way to get an applet delivered from a portlet?
> 
> Steve Forsyth 
> Software Design Engineer
> Software Global Business Unit
> Hewlett-Packard Company
>