OBJECT TAG

Hi Experts,

Can I and How to replace code within JSP to run applet using <OBJECT> tag with the applet using <APPLET> or anything else
to be able to access class from this applet ?

Thank you.
LVL 1
fpoyavoAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
KuldeepchaturvediConnect With a Mentor Commented:
that means the class that you are loading is not an APPLET...!! go to java.sun site and look the documentation of the example class that you are loading....
it is quite possible that its not a applet but just a class and which case it will work with OBJECT tag but won't with APPLET..
0
 
fpoyavoAuthor Commented:
The reason is that with this tag I was not able to access anything and was given message that applet object does not exist but
in the IE status bar I see it is initiated, started, loaded.

Thank you.
0
 
rrzCommented:
What did the Java Console report ?  
Please show us your code ?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
KuldeepchaturvediCommented:
Can't figure out what you are trying to do here... can you post your code and point us what its not doing??
0
 
fpoyavoAuthor Commented:
I am trying to access class defined within applet via Javascript. It is a simple Applet.
0
 
fpoyavoAuthor Commented:
I mean simple simple just for learning but it uses <OBJECT> tag . How to replace this <OBJECT> tag with <APPLET> but to
keep same functionality ?

Thank you.
0
 
KuldeepchaturvediCommented:
<APPLET NAME='screenCapture' Code='ScreenCaptureApplet'  CODEBASE='../classes' width=100 height=100></APPLET>

and in the java script

document.screenCapture.captureImage(00,100,100,100,imgdescription);
                        

here captureImage is a method written inside the Applet..

I know it works
0
 
fpoyavoAuthor Commented:
I will try it today and get back. Thank you.
0
 
objectsCommented:
does your applet require the java plugin?  If it does then the <applet> tag will not work unless the user has the plugin setup as their default vm.

> and was given message that applet object does not exist

where are you getting this message.
0
 
fpoyavoAuthor Commented:
So... here is the code :

<%
String someID = request.getParameter( "id" );
if ( someID == null ) someID = "-1";
%>
<html>
<head>
<title>MyApplet</title>
 

<script language="javascript">

function getmyid()
{

alert("started");

// I was trying too
//var appObj = document.getElementById('myapplet');
//var myid = appObj.getId();


// message that does not exist


var myid = document.myapplet.getID();


alert("here it is : " + myid);

}

</script>

</head>
<body bgcolor="#002341">
<img src="Submit.gif" onClick="getmyid()"></img>

<center>
 
<OBJECT classid = "clsid:CAFEEFAC-0014-0001-0000-ABCDEFFEDCBA" codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_1-windows-i586.cab#Version=1,4,1,0" WIDTH="100%" HEIGHT="100%">
      <param name="NAME" value="myapplet" MAYSCRIPT>
      <param name="CODE" value="com.sample.mybrowser.samplemybrowserApplet.class" width="50" height="50" MAYSCRIPT>
      <param name="ARCHIVE" value="sample.jar, nanoxml-2.1.1.jar, Browserutil.jar, Myutility.jar, dom.jar" MAYSCRIPT>
      <param name="type" value="application/x-java-applet;jpi-version=1.4.1">
      <param name="scriptable" value="true">
      <param name="browser" value="false">
      <param name="focusID" value="<%=someID%>">
      <param name="bgImage" value="background.gif">
      <param name="apachePort" value="8081">
      <param name="tomcatPort" value="8080">
     

    <COMMENT>
      <EMBED type = "application/x-java-applet;jpi-version=1.4.1" CODE="com.sample.mybrowser.samplemybrowserApplet.class" WIDTH="50%" HEIGHT="50%" scriptable="true" pluginspage="http://java.sun.com/products/plugin/index.html#download" MAYSCRIPT>
          <NOEMBED>
            alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
                    Your browser is completely ignoring the &lt;APPLET&gt; tag!
            </NOEMBED>
      </EMBED>
    </COMMENT>
</OBJECT>
</body>
</html>


It returns onclick that : "document.myapplet   is null or not an object"

How to make it work ?.

Please help.
0
 
KuldeepchaturvediCommented:
Are you sure that your applet is getting loaded???
with the code given here, it looks like you are trying to load a applet from Sun site and not your own applet...

If your applet is getting loaded then you shd see a little coffee cup in your taskbar area ....

0
 
fpoyavoAuthor Commented:
i DO see that cup and message in status bar "myapplet is loaded" and it is working fine.

The problem is that I need to access class from this applet. I was thing that the problem was due to <OBJECT> tag use.

When use <APPLET> tag instead it does not load and I see "red cross" image in the left upper conner.


Please help.
0
 
fpoyavoAuthor Commented:
correction: I was thinking that the problem was due to <OBJECT> tag use.
0
 
fpoyavoAuthor Commented:
Is there any way to get it WORKING in <APPLET> ?
0
 
KuldeepchaturvediCommented:
Not if the class is not an APPLET
0
 
fpoyavoAuthor Commented:
Kuldeep,

Would you please look at another question I have :

http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_20947874.html
0
 
fpoyavoAuthor Commented:
Do you think its possibly to download this class and make it APPLET ?
0
 
KuldeepchaturvediCommented:
you can defenitly try that...
I am willing to help you with that once you get the code of that class....
0
 
objectsConnect With a Mentor Commented:
try this:

<APPLET CODE="com.sample.mybrowser.samplemybrowserApplet.class" archive="sample.jar, nanoxml-2.1.1.jar, Browserutil.jar, Myutility.jar, dom.jar" WIDTH=50 HEIGHT=50 NAME="myapplet" MAYSCRIPT>
     <param name="scriptable" value="true">
     <param name="browser" value="false">
     <param name="focusID" value="<%=someID%>">
     <param name="bgImage" value="background.gif">
      <param name="apachePort" value="8081">
      <param name="tomcatPort" value="8080">
</APPLET>
0
 
fpoyavoAuthor Commented:
Let me try. I will get back.
0
 
anthony_castillonCommented:
Since you're using JSP, why don't you use the <jsp:plugin > action tag?.  In using it, you have to define the classname, among other things.  The beauty of this action tag is that the HTML code for the applet will be created to fit the browser you're working with, i.e., it will use the OBJECT tag or APPLET tag depending on the browser you're using.

You can also define parameters within the tag using the <jsp:params> tag.

Hope this helps.
Anthony
0
 
objectsCommented:
>  i.e., it will use the OBJECT tag or APPLET tag depending on the browser you're using.

Its more what vm's are being used that dictates which tag to use.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.