RE: Can servlet generate a Web page first, then continue to run ?

2004-05-06 Thread Yansheng Lin
How about using Thread:).  If you are keen, you can create a thread manager
and explode your code to 10 times of its original complexity, which makes
the maintainence a nightmare.  And then you will thank me for such a
wonderful experience.

Life is beautiful sometimes:).

-Yan Lin
Sun Certified J2EE Web Component Developer
http://j2e-translate.sourceforge.net (need help)

-Original Message-
From: Tom K [mailto:[EMAIL PROTECTED] 
Sent: May 5, 2004 08:24
To: 'Tomcat Users List'
Subject: RE: Can servlet generate a Web page first, then continue to run ?


Stan,

I have done something similar in a servlet by reposting to the
same servlet. The way I did this is by out-putting a hidden value in the
submission, then using a getParameter to retrieve this value on the next
submit. The first page was the user submitting some data, which when
submitted brought up a proof-read-page. If everything was OK they would
hit the submit button again (so the same page was actually generated
twice. The servlet would know to go to the correct processing part of
the servlet because of the hidden parameter would direct it to that part
of the servlet that did the processing.
For example, I hid a value called action with a value of
step2. In my servlet I had code that... if(action.equals(step2)){
..do something ...}+
So how might this apply to your problem? I'm not sure :-( but it
might spark an idea.

Tom Kochanowicz




-Original Message-
From: lixiaoquan [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 05, 2004 5:02 AM
To: [EMAIL PROTECTED]
Subject: Can servlet generate a Web page first, then continue to run ?

hi,

I want to show a page immediately after the visiters' Form Submitting
,then do some logical processing at backgroud(this will assume a long
time, so it may bother the visitor).  I surpose to do these in one
servlet.

How can I do this?

Thanks
 
stan

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Can servlet generate a Web page first, then continue to run ?

2004-05-05 Thread STOCKHOLM, Raymond
If you explicitely close your writer (the outputstream) in your servlet, the client 
will receive your page,
and your servlet will be able to continue to work :

protected void processRequest(HttpServletRequest request,  HttpServletResponse 
response)
throws ServletException , IOException {
PrintWriter out = response.getWriter();
out.println(Page to display to client);
out.close();
// Do some work in your servlet...

}

-Message d'origine-
De: lixiaoquan [mailto:[EMAIL PROTECTED]
Envoy: mercredi 5 mai 2004 12:02
: [EMAIL PROTECTED]
Objet: Can servlet generate a Web page first, then continue to run ?


hi,

I want to show a page immediately after the visiters' Form Submitting ,then do some 
logical processing at backgroud(this will assume a long time, so it may bother the 
visitor).  I surpose to do these in one servlet.

How can I do this?

Thanks
 
stan


Re: Can servlet generate a Web page first, then continue to run ?

2004-05-05 Thread lixiaoquan
hi, 
It works.
Thank you so much.

stan

- Original Message - 
From: STOCKHOLM, Raymond [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, May 05, 2004 6:16 PM
Subject: RE: Can servlet generate a Web page first, then continue to run ?


 If you explicitely close your writer (the outputstream) in your servlet, the client 
 will receive your page,
 and your servlet will be able to continue to work :
 
 protected void processRequest(HttpServletRequest request,  HttpServletResponse 
 response)
 throws ServletException , IOException {
 PrintWriter out = response.getWriter();
 out.println(Page to display to client);
 out.close();
 // Do some work in your servlet...
 
 }
 
 -Message d'origine-
 De : lixiaoquan [mailto:[EMAIL PROTECTED]
 Envoy : mercredi 5 mai 2004 12:02
  : [EMAIL PROTECTED]
 Objet : Can servlet generate a Web page first, then continue to run ?
 
 
 hi,
 
 I want to show a page immediately after the visiters' Form Submitting ,then do some 
 logical processing at backgroud(this will assume a long time, so it may bother the 
 visitor).  I surpose to do these in one servlet.
 
 How can I do this?
 
 Thanks
  
 stan
 


RE: Can servlet generate a Web page first, then continue to run ?

2004-05-05 Thread Budi Kurniawan
You can use event-listeners. In servlet 2.3 there are two types of events:
application- and session-. Servlet 2.4 adds another one
request/response-events. 
This way, you code is much more modular.


-Original Message-
From: lixiaoquan [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 05, 2004 8:02 PM
To: [EMAIL PROTECTED]
Subject: Can servlet generate a Web page first, then continue to run ?

hi,

I want to show a page immediately after the visiters' Form Submitting ,then
do some logical processing at backgroud(this will assume a long time, so it
may bother the visitor).  I surpose to do these in one servlet.

How can I do this?

Thanks
 
stan


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Can servlet generate a Web page first, then continue to run ?

2004-05-05 Thread Tom K
Stan,

I have done something similar in a servlet by reposting to the
same servlet. The way I did this is by out-putting a hidden value in the
submission, then using a getParameter to retrieve this value on the next
submit. The first page was the user submitting some data, which when
submitted brought up a proof-read-page. If everything was OK they would
hit the submit button again (so the same page was actually generated
twice. The servlet would know to go to the correct processing part of
the servlet because of the hidden parameter would direct it to that part
of the servlet that did the processing.
For example, I hid a value called action with a value of
step2. In my servlet I had code that... if(action.equals(step2)){
..do something ...}+
So how might this apply to your problem? I'm not sure :-( but it
might spark an idea.

Tom Kochanowicz




-Original Message-
From: lixiaoquan [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 05, 2004 5:02 AM
To: [EMAIL PROTECTED]
Subject: Can servlet generate a Web page first, then continue to run ?

hi,

I want to show a page immediately after the visiters' Form Submitting
,then do some logical processing at backgroud(this will assume a long
time, so it may bother the visitor).  I surpose to do these in one
servlet.

How can I do this?

Thanks
 
stan

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]