Bill,
onSubmit="window.close()" will close the browser window immediately, before
the HTTP request can get to your servlet, and hence before your servlet
gets the chance to execute. You're going to need to let it execute, so my
suggestion would be to have the servlet forward to an almost empty page
(instead of back to the same page) which has the following body tag:

<BODY onLoad="window.close()">

Alternatively, you could do this using the same page by passing a parameter
back (or store it in a bean), and if the parameter (or property) is found,
then write the above JavaScript into the page.

Some advice - using pop-up windows in this way is not very user-friendly,
and as you can see the development aspects aren't much better. You can
potentially run into session issues in different browser windows with
certain settings in IE 4 and 5 (Craig and I have both mentioned this in the
past).  I would try to find a way to do this within the same browser
window. See a previous email of mine to the list for some good reasons not
to implement pop-up windows in a Web application (let me know if you can't
find it).

Eric M. Andersen
I/T Specialist
IBM Global Services
Tel: (781) 895-2637,   Fax : (781) 895-2843, t/line : 362-2637
Internet ID:  [EMAIL PROTECTED]
Lotus Notes ID: Eric M Andersen/Waltham/IBM


"Hines, Bill" <[EMAIL PROTECTED]>@JAVA.SUN.COM> on 02/27/2000 08:21:22 PM

Please respond to "Hines, Bill" <[EMAIL PROTECTED]>

Sent by:  A mailing list about Java Server Pages specification and
      reference <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:
Subject:  Pop-Up Form Window?



I'm here late on Sunday night trying to get a project done for this week, I
have to demo it on Tues and there is one last part I can't figure out.

My main JSP page has a list of items on it. There is a small graphic next
to
each item in the list that says "Order". When the user clicks that, the
item
number and description are sent to a servlet which pulls them from the
session, creates an OrderItem bean and puts it in the session, then calls
the JSP page with target="_blank". This page has a form that shows the item
number and description and asks the user for the quantity.

I want the user to be able to press the submit button to submit the order
and close the window. If I put onSubmit="window.close()" in the <form> tag,
the form data never gets put in the session. If I take the onSubmit out, it
works great but the extra window sticks around and the item list redisplays
there. How can I get the pop-up window to close and do the submit like I
need?

Thanks, Bill

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to