Solved

OBJECT TAG

Posted on 2004-04-07
24
245 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
loop through list of objects 14 186
servlet init param and contect param 3 53
'exit' is not valid keyword in java 14 134
own marker interface 1 44
A Short Story about the Best File Recovery Software – Acronis True Image 2017
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now