may Lee

Ranch Hand
+ Follow
since Nov 20, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by may Lee

In IE or Netstacp, when the web page is loading, a small icon on the top right corner in IE or a moving strip on the bottom left cornor in Netscape will be moving until the page is loded. I am wondering, how can I get the similar thing working in applet? What I want it: when the user click a submit button in my applet on the webpage, a small icon on the top right or on the bottom begins moving, like in IE and Netscape, then when the page loding finihsed, the icon stop moving.

I know to use showStatus("") in applet to write some message on the bottom left cornor, but I would like to have an icon to show data is still loading.

I heard these kinds of moving icon is a kind of Java script. Could any one give me a clue how to do this?

Thanks a lot
In IE or Netstacp, when the web page is loading, a small icon on the top right corner in IE or a moving strip on the bottom left cornor in Netscape will be moving until the page is loded. I am wondering, how can I get the similar thing working in applet? What I want it: when the user click a submit button in my applet on the webpage, a small icon on the top right or on the bottom begins moving, like in IE and Netscape, then when the page loding finihsed, the icon stop moving.

I know to use showStatus("") in applet to write some message on the bottom left cornor, but I would like to have an icon to show data is still loading.

I heard these kinds of moving icon is a kind of Java script. Could any one give me a clue how to do this?

Thanks a lot
19 years ago
I found the solution for my problem. Share it here, hope it can give people some idea when they meet similar problems.

The error is because of the CODEBASE and servletPath. I am using proxy server to publish my website. Before I used private IP addresse for the CODEBASE and servletPath. So I changed them to the public IP address and make map of the public and private IP address on the proxy server. Now it is working.
19 years ago
I am not clear what to do with the invoker. The following is my web.xml for the servlet under Tomcat. How to change? Could you show me?

<?xml version="1.0" encoding="ISO-8859-1"?>



<!DOCTYPE web-app

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">



<web-app>


<servlet>
<servlet-name>servletToapplet</servlet-name>
<servlet-class>servletToapplet</servlet-class>
</servlet>


<servlet-mapping>

<servlet-name>invoker</servlet-name>

<url-pattern>/servlet/*</url-pattern>

</servlet-mapping>



<servlet-mapping>
<servlet-name>servletToapplet</servlet-name>
<url-pattern>/servletToapplet</url-pattern>
</servlet-mapping>


</web-app>
19 years ago
Here is part of my code in applet and servlet, not complete of course:

(1) Part code of applet

/*In the applet code, I define the servlet path like this*/
String servletPath="http://192.168.0.24/myservlet/servlet/servletToapplet";

/* This is part of the applet code to send date to servlet*/
try{
URL url=new URL(servletPath);
URLConnection conn=url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setDefaultUseCaches(false);
/****send object from applet to servlet******************/
conn.setRequestProperty("Content-Type","application/octet-stream");
ObjectOutputStream toServlet=new ObjectOutputStream(conn.getOutputStream());
toServlet.writeObject(datato);
toServlet.flush();
toServlet.close();
/****get object df from servlet*********/
ObjectInputStream fromServlet=new ObjectInputStream(conn.getInputStream());
datafrom=(dataFromservlet)fromServlet.readObject();
fileexist=datafrom.fileexist;
servleterror=datafrom.servleterror;

}

(2)
/* This is part of servlet code, to show how servlet get date from applet and*/

try{
/****servlet gets input stream from applet***********************/
fromApplet=new ObjectInputStream(request.getInputStream());
/**read the serialized object (dataToservlet) from applet**/
dt=(dataToservlet) fromApplet.readObject();
fromApplet.close();
....


(3)
/*this is part of the servlet code to show how servlet send data back to applet by object*/
response.setContentType("java-internal/"+dataFromservlet.class.getName());
toApplet=new ObjectOutputStream(response.getOutputStream());
toApplet.writeObject(df);
toApplet.flush();
toApplet.close();
19 years ago
I did a test with my program without passing throguh the proxy server, I mean all
are on the private network, the webserver only on the private LAN and I access the website from LAN, there is no any map between private and public IP address for applet CODEBASE and servlet path, then it works well even for long time period, eg 5 days. SO I guess, it may be some timeout problem on the ISA proxy server when the mapping between private and public IP address is timeout.

Because when users ask data of long time period, say more than one day, the servlet takes at least more than 6-7 minutes to get all the data on the LAN, if asking for 5 days' data, it will take maybe 20 minutes to get the data, so maybe the mapping on ISA proxy server or the HTTP connection between servlet and applet cannot exist so long?

I am still looking for solutions. Any suggestion is appreciated. Thanks a lot.
19 years ago
My websbite (Apache) uses private IP address and is publihsed by a Microsoft ISA proxy server. Public Internet users can access the website through the proxy server.

On my website, it uses applet to send date to servlet (they are on the same computer), then servlet searches data according to the date from applet and send the data back to applet. When the date is less than one day long, it works well, when the date is more than one day, it shows the following error:

java.io.IOException: Server returned HTTP response code: 504 for URL:http://11.11.11.11:8080/myservlet/servlet/...'

The servlet and applet use ObjectInputStream and ObjectOutputStream to communication with each other.

I check the error code, it is said:
Status code (504) indicating that the server did not receive a timely response from the upstream server while acting as a gateway or proxy.

But I still don't understand the error clearly, and how to solve the problem? Thanks for any suggestion!
19 years ago
I tried to compile my applet with Java 1.4 before, but IE could not run my applet, it was a grey box. So I compile it with java1.2, then IE can run my applet, but get this problem, I mean only run a couple of time.

Install the latest plug-in, maybe this is the last solution. It is just that users visiting my websit could feel troublesome if they need to downlaod and install something to see the website.
20 years ago
I use applet choice list on my webpage, uses input date by choice list. The date is sent to servlet do some calculation, then servlet sends back some information.
The problem is: after input date for a couple of times, if I want to input new date again,the applet doesn't send the date to servlet. I need to refresh IE, then input date, it works for one time. Then refresh, input date, then it works one time. What to do with it?

I am uing WinXP IE6, I don't install any plug-ins.
20 years ago
It is IE 6 on WinXP, using its original MS java.
I have not installed any new plug-ins.
I am using Java-1.2.2 and Tomcate 4.30 on my linux box.
Do you think the new plug-in is needed? If so, it might be a bit troublesome when your web visitors have to install new plug-in? Is it? Or there is some other solution, such as change some configuration on IE?
20 years ago
More information:

I monitor Memory and CPU usage on both client PC and Linux server box when I use IE to connect to my website on Linux Apache server. The Mem and CPU usage on both box are normal, excep when servlet running the calculation, at one moment CPU usage on Linux box is high, then it decreased to 0 after it finished the task.

If I use Mozilla on the Linux server, I can visit my web page as many time as I want.

I found, when I run IE to visit my web page, first I can input the date by applet for a couplr of times to get the data graoh, then when I input the date one more time, the date is not sent to servlet for calculation (cos nothing happen on CPU usage on Linux server box) and I cannot click the choice list on the applet on the web page. But I can use Refresh in IE to refresh the web page then input the date again, refresh and input the date, repeat like.

So looks like it is applet problem on IE, which cannot run as many as i want. Need to be refresh each time before I input the new date.

What is the solution to solve this porblem? Thanks for any idea!
20 years ago
It is a strange problem. My environment: Redhat 9,Apache 2 as web server, Tomcat for servlet.

When uses visit my web page on Apache server and input the date by applet, the date is sent to servlet on Tomcat, servlet calculate and sends back an integer array[6][300], then applet plot graph according to the integer array in its canvas.

I use IE test my web. It is working, but strange thing is: it cannot run many times. I mean, first use inputs one date and get the graph, then use input a new date, get new graph, then third time. But at fourth time, the IE frozen. On one PC, IE can do this 3 time, on the other one, IE can do this 5 times. I have no idear what the porblem could be! Web server is not cofnigured right? or Servlet connection is not limit? or some resource wrong? or other reason?
Thanks for any suggestion!
20 years ago
Not sure if this is the suitable place to ask this question or I should move to Apache?
My environment: Redhat 9,Apache 2 as web server, Tomcat for servlet.

When uses visit my web page and input the date by applet, the date is sent to servlet on Tomcat, servlet calculate and sends back an integer array[6][300], then applet plot graph according to the integer array in its canvas.

I use IE test my web. It is working, but not more than many times. I mean, first use inputs one date and get the graph, then use input a new date, get another graph, then continue. One one PC, it can only do this 3 time, on the other one, it can do this 5 times. On my linux bos, looks like it can do this more than 5 times. I have no idear what the porblem could be!!! Please give me some suggestion!!!
20 years ago
I found the error, it is array dimention mistake. I use channel3[400][3] in the part that convert string to float data, after I write the new part,I define it as channel3[3][400], but I still copy the part of converting, so get error. Interesting thing is, it told me EOFException error, not array index error, which led me to think about my file end,...
anyway, found the misktake finally!!
20 years ago
I tried Tim's method, same error when I add the convert part.
I tried to only use readLine() and display the line, it works, I mean, it read line by line.
Also when I use applet to do the servlet part function, it is working with the same code. So there must be some secret error not found. Keep working to find it.

I am wondering, is there a way to do step by step debug of applet and servlet communication programs?
20 years ago