aspose file tools*
The moose likes JSP and the fly likes How to exit from a jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to exit from a jsp page" Watch "How to exit from a jsp page" New topic
Author

How to exit from a jsp page

ramesh poorella
Ranch Hand

Joined: Jul 19, 2011
Posts: 60
Hi

i have one exit button . when i am click that button i want to exit from jsp page
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

By exit do you mean to move out to another page or close down the application.

If its moving to some other page, try using <c:redirect> or <c:url>


Ashwin Sridhar
SCJP | SCWCD | OCA
ramesh poorella
Ranch Hand

Joined: Jul 19, 2011
Posts: 60
Ashwin Sridhar wrote:By exit do you mean to move out to another page or close down the application.

No i want to close my browser window
N Sahni
Ranch Hand

Joined: Jul 07, 2011
Posts: 55

You can do it in javascript by using window.close().

You might also want to check out this topic close browser window!


Thanks and Regards,
Nilesh Sahni | nsahni@infocepts.com | www.infocepts.com
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

if you need to close the browser itself, you could use javascript.

But i am not sure how good a practce it is, to use javascript in a JSP file
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
Ashwin Sridhar wrote:But i am not sure how good a practce it is, to use javascript in a JSP file

Using scriptlets inside a JSP is a bad practice, using Javascript is not. Usually client-side validations are done using javascript.

For the original poster, window.close() can be used.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Just to forestall the inevitable next question, no, window.close() will not work. Browser security prevents closing a window that was not opened by window.open().

Besides, it's not your browser! You have no business trying to close it!


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to exit from a jsp page