Solved

OBJECT TAG

Posted on 2004-04-07
24
248 Views
Last Modified: 2010-04-01
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.
0
Comment
Question by:fpoyavo
  • 11
  • 6
  • 3
  • +2
24 Comments
 
LVL 1

Author Comment

by:fpoyavo
ID: 10774787
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
 
LVL 27

Expert Comment

by:rrz
ID: 10774968
What did the Java Console report ?  
Please show us your code ?
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10775295
Can't figure out what you are trying to do here... can you post your code and point us what its not doing??
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:fpoyavo
ID: 10776510
I am trying to access class defined within applet via Javascript. It is a simple Applet.
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10776691
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
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10777025
<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
 
LVL 1

Author Comment

by:fpoyavo
ID: 10777264
I will try it today and get back. Thank you.
0
 
LVL 92

Expert Comment

by:objects
ID: 10779191
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
 
LVL 1

Author Comment

by:fpoyavo
ID: 10783672
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
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10783724
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
 
LVL 1

Author Comment

by:fpoyavo
ID: 10783924
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
 
LVL 1

Author Comment

by:fpoyavo
ID: 10783934
correction: I was thinking that the problem was due to <OBJECT> tag use.
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 250 total points
ID: 10784071
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
 
LVL 1

Author Comment

by:fpoyavo
ID: 10784498
Is there any way to get it WORKING in <APPLET> ?
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10784553
Not if the class is not an APPLET
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10784644
Kuldeep,

Would you please look at another question I have :

http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_20947874.html
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10786019
Do you think its possibly to download this class and make it APPLET ?
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10786292
you can defenitly try that...
I am willing to help you with that once you get the code of that class....
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 10787379
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
 
LVL 1

Author Comment

by:fpoyavo
ID: 10788195
Let me try. I will get back.
0
 
LVL 2

Expert Comment

by:anthony_castillon
ID: 10790510
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
 
LVL 92

Expert Comment

by:objects
ID: 10795043
>  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

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Apache-Tomcat Single Sign On with NTLM/Kerberos on Windows 2008R2 3 229
immutable object concept 5 127
Unhandled exception type Exception 18 42
how to debug htl and js pages 8 38
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question