![]() |
| ||
| servlet: why the service method run twice in special time the question description: when I read a jpg file, there is no any problem. but when I try to read a mht file, the service method was run twice. why? Can anyone give me a satisfying explain? Thanks first in here. public class ShowImageServlet extends HttpServlet { <%@ page language="java" contentType="text/html; charset=GBK" %> |
| ||
| Re: servlet: why the service method run twice in special time Oh, sorry. I have submited a bad question. I will describe the question more in detail. I have traced the action. When read a mht file. The first time, the character part was loaded, and the image part will be loaded in the second. But I will catch a Exception. IOException, the Exception's name is AbortClientException, Such as socket reset. My Environment is Tomcat5.0.28. And I issue the program on WebSphere, there is no Exception, but still run twice. I have deal with the IOException, when the name is AbortClientException, I will not log the logs. But I still want know why should the servlet run twice. Thanks. |
| ||
| Re: servlet: why the service method run twice in special time Don't override service; just override the method which you want to support and accordingly override the doGet()or doPost()method. The `action' attribute of the FORMtag is mandatory. You don't need to use Javascript, just use the action attribute of FORMtag with a normal submit button. Also there is no reason for a service method to run twice unless there actually were requests made; print out the request.getRequestURL()inside your request handling method to see which URL was requested by the client. In case your page references other resources like images or Javascript files present on the server and your web.xmlmaps each request to your servlet, the multiple invocations might just be explained. |
| ||
| Re: servlet: why the service method run twice in special time thanks. maybe. But I have tried that before you give me that advice. I can't find anything. And I can't get any suggestion from google. You can try read mht files by yourself. If you don't get any Exception or you just request once and get the mht file loaded. you maybe should test many times. please tell me if you have tried. you are welcome here.(you can get my servlet name in my code, ShowImage) |
| ||
| Re: servlet: why the service method run twice in special time Attach a war file of your project so someone can try it out. |
| ||
| Re: servlet: why the service method run twice in special time sorry. I can't find the button to attach the war file. maybe you can create a new small project. and put the servlet and the jsp in it. It will not take your much time. ^_^ thanks for your attention. |
| All times are GMT -4. The time now is 3:34 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC