• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to exit from a jsp page

 
ramesh poorella
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i have one exit button . when i am click that button i want to exit from jsp page
 
Ashwin Sridhar
Ranch Hand
Posts: 277
Flex Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
ramesh poorella
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do it in javascript by using window.close().

You might also want to check out this topic close browser window!
 
Ashwin Sridhar
Ranch Hand
Posts: 277
Flex Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65118
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic