Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

IO Error in Explorer

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a very peculiar problem. I have made a applet which is supposed to communicate with a servlet which in turn stores data in a database. Now the problem is that when i am running the applet in Netscape Navigator everything is occuring perfectly
fine, but with Microsoft Explorer 5.0 everything goes wrong.
The concept is that in an HTML page the moment a person moves his mouse over a link (any link) the link is to be recorded in the database. What i have done is that with the applet i am sending two parameters. Now the javascript senses the movement of mouse over the links and changes the parameters. Once there is a change of parameters the applet communicates
with the servlet and the data is recorded. This is working fine in Netscape Navigator, however in Internet Explorer 4.0/5 nothing happens. The connection is not made nor is any exception thrown I am sending to you the codes for the applet, javascript.
Pls. check this for me and advise.
Thanks
Hemant Gupta
Code for Applet
Tracker.java

import java.applet.*;
import java.net.*;
import java.io.*;
import java.util.*;
public class tracker extends Applet implements Runnable{
public String currentlink;
public boolean timeit;
String username;
String page;
Thread th;
Date startedAt;
public void start()
{
if(th==null)
{
th=new Thread(this);
th.setPriority(4);
th.start();
}
}
public void init()
{
timeit=false;
startedAt=new Date();
username=getParameter("user");
page=getDocumentBase().toString();
currentlink="none";
}
public void run(){
String xyz=currentlink;
while(true)
{
if(timeit)
{
startedAt=new Date();
timeit=false;
}
if(!xyz.equals(currentlink))
{
Date now=new Date();
int duration=(int)(now.getTime()-startedAt.getTime());
try
{
if(duration>500)
{
URL listURL = new URL("http://www.abcd.com/servlet/ads.mouseact.class?"+URLEncoder.encode("user")+"="+URLEncoder.encode("sd"+username)+"&"+URLEncoder.encode("link")+"="+URLEncoder.encode(curre ntlink)+"&"+URLEncoder.encode("time")+"="+URLEncoder.encode(String.valueOf(duration).trim())+"&"+URLEncoder.encode("page")+"="+URLEncoder.encode(page));
URLConnection listConn = listURL.openConnection();
listConn.setDefaultUseCaches(false);
listConn.setUseCaches(false);
listConn.connect();
showStatus("Tracking now");
}
Thread.sleep(500);
}catch(Exception ex){
showStatus(ex.toString());
}
xyz=currentlink;
startedAt=now;
}
}
}
public void stop(){
try{
URL listURL = new URL("http://www.abcd.com/servlet/ads2.timecheck.class?user=sd"+username);
URLConnection listConn = listURL.openConnection();
listConn.setDefaultUseCaches(false);
listConn.setUseCaches(false);
listConn.connect();
}catch(Exception ex){
}
}
}

Code for Javascript
function changeOfParams(nm)
{
if(navigator.appName=="Netscape")
document.dctracker.currentlink=nm;
else
document.all.dctracker.currentlink=nm;
}
function changeOfTimer()
{
if(navigator.appName=="Netscape")
document.dctracker.timeit=true;
else
document.all.dctracker.timeit=true;
}

Html File
<html>
<head>
<title>Demo page</title>
<Script language="JavaScript" src="tracker.js">
< !--<br /> //-->
</script>
</head>
<body>
<applet name=dctracker code=tracker.class width=1 height=1>
<param name=user value=lalu>
<param name=link value=none>
</applet>
a link

b link

c link

d link

</body>
</html>

 
Manish Joshi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When evr You upload an applet You also have to take care about its Security issue Have taken care ecause once you use Applet you have restricted rights and restricted operation which can be performed Please do findout more on how to sign your Applets and then make them available to be on the host or so
You will have to get your Applet signed
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!