• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet inside a Portlet

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
Am trying to embed an applet inside a portlet jsp. But when i access the jsp from the IE. I dont see the applet being rendered on the page. I think its the problem of my applet codebase but not sure how to get through. Below is my jsp code which is being rendered.

<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%>
<portlet efineObjects />


<script type="text/javascript">
alert("test123");
alert("<%=renderResponse.encodeURL(renderRequest.getContextPath() + "/lib2")%>");
</script>


<applet WIDTH = "50%" HEIGHT = "92%" NAME = "Applet" ALIGN = "middle" BORDER = "0"
CODE = "com.test.MyApplet.class"
CODEBASE = 'renderResponse.encodeURL(renderRequest.getContextPath()) + "/lib2"'
ARCHIVE = "sao.jar,sAOClient.jar">
<param name= "scriptable" value="true">
<PARAM NAME = 'env' VALUE='local'>

</applet>


And i have copied all the required jars for the applet under

/WebContent/lib

and just for testing i also copied the jars to

/WebContent/WEB-INF/lib2

and i tried the codebase as :
CODEBASE = 'renderResponse.encodeURL(renderRequest.getContextPath()) + "/lib2"'

or

CODEBASE = 'renderResponse.encodeURL(renderRequest.getContextPath()) + "/lib"'


both of the above statements dont work. And i dont even see anything on my java console or my server logs.

Can someone please advise where i am getting it wrong.
I am using RAD7, WebSpherePortal 6.0 server
Thanks,
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Applets can't access anything that's inside of the WEB-INF directory (because nothing will be served out of that directory directly to the client). You need to move the jar files into a publicly accessible directory.
 
Amit Hetawal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Ok so i removed the jars from my WEB-INF/lib2 directory, and i just keep all my jars needed by applet in the WebContent/lib folder.
But still i am not able to access those in my codebase tag.
Any advice on that.

Thanks,
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does the HTML of the applet tag look like that gets rendered?
 
Amit Hetawal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Along with all the other HTML of the portlet rendering, i see the HTML tag for my applet as :

<applet WIDTH = "50%" HEIGHT = "92%"
CODE = "com.test.NavigatorUI.class"
CODEBASE = "/.StreamPortlet2/lib2/"
ARCHIVE = "sao.jar,sAOClient.jar>
<param name= "scriptable" value="true">
<PARAM NAME = 'env' VALUE='local'>

</applet>
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The codebase should be relative to the HTML file that contains the applet tag - in other words, it shouldn't start with a slash.

Check the server access logs to see which jar files the browser is actually trying to download, and make sure those exist and are world-readable.
 
Amit Hetawal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Where do i find the server access logs. I dont see the any activity for the logs under
C:\ibm\WebSphere2\profiles\wp_profile\logs\WebSphere_Portal

And for the codebase i tried using the solution as given on this thread not sure why its not working.
http://fixunix.com/websphere/264663-create-applet-portlet.html
http://www-128.ibm.com/developerworks/forums/message.jspa?messageID=2399408&q=%2Bapplet%2Bin%2Bportlet#2399408

both the above approaches not working, just not sure why.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are there any error messages in the Java console?

What was the result of fixing the value of the codebase attribute?

Can you get the applet to work outside of the portal server with that applet tag?
 
Amit Hetawal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are no messages on the java console. Although it opens up the javacosole when the page is rendered. So i assume its reading the applet tag as required.
But when it goes to codebase it just cant find and it just stops showing me a blank page without and blank java console without any jars downloading showing.

I tried my combinations of codebase none of them work i still get the blank page. I even removed the codebase attribute and just placed all the jars directly under WebContent dir. Still it cannot find it from there too.

Yes when i try the same applet tag from a jsp on Wwebsphere 5.1 App server it works perfectly fine. There i keep all my jars under WebContent/lib, and my jsp is under WebContent, same as i have in the portal env.

Still trying ....

Thanks,
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Strange. Actually, I'm not sure that codebase is used for loading jar files. Try putting them in the same directory as the file containing the applet tag.
 
Amit Hetawal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes did that too, but no help.

Short of ideas now ....
 
Amit Hetawal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, finally i got my applet working, from my portlet.
So my final working jsp looks like :

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%>
<%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<portlet efineObjects />
<p>Place content here.</p>

<applet id = "NavigatorUI" WIDTH = "500" HEIGHT = "500"
CODE = "com.local.NavigatorUI.class"
CODEBASE ='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/_testPortletStream/jsp/html/") %>'
ARCHIVE = "sao.jar,sAOClient.jar>
<PARAM NAME = 'env' VALUE='DEV'>
</applet>

<p>Place content here123.</p>

And the problem was caused by :
using WIDTH="100%" instead of WIDTH="500", i read it on some link stating portal server cannot recognize applet if the size is given in "%", and so this was stopping my applet tag to work fine.

Now everything looks good,
Thanks Ulf, for you help during this struggle !!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic