aspose file tools*
The moose likes Servlets and the fly likes Open a new tab from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Open a new tab from a servlet" Watch "Open a new tab from a servlet" New topic
Author

Open a new tab from a servlet

Vivek Kr Agrawal
Ranch Hand

Joined: Sep 08, 2012
Posts: 51

Hi all,During my project developement I have came across with a strange problem.
I want my parent page(lets say index.jsp) page to be consistent and based on certain selections or events., the request should go back to the servlet and a new tab (new.jsp) should open in the browser. I would like to mention that my browser is IE and I don't want to use pop-up using javaScripts.

Thanks in advance,

Vivek


Vivek Agrawal
Om Prakash Bijawat
Greenhorn

Joined: Feb 01, 2013
Posts: 10
Opening a new tab is the functionality of java script or HTML.

One option to do is use anchor tag on your index.jsp and within that anchor tag write href = "/yourServletName" and target = "_blank" .It will redirect you to your servlet and in your servlet coding use sendRedirect("new.jsp");


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60059
    
  65

It doesn't matter if the servlet redirects or not in this case.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vivek Kr Agrawal
Ranch Hand

Joined: Sep 08, 2012
Posts: 51

Hi all,
I know there is no simple way to do this. But atleast can you tell how to open a new tab in IE(7+) by javascript or from server side.
Note:I don't want new window(which currently I am getting).

Regards,
Vivek Agrawal
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

Have you searched around for an answer? It took me less than a minute to find references that helped me come to the conclusion that there is no reliable way to consistently do what you intend to do. Search for "programmatically open new browser tab" ← click the link to see the references I found and see for yourself.

Perhaps you need to rethink your user experience design.


Junilu - [How to Ask Questions] [How to Answer Questions]
Vivek Kr Agrawal
Ranch Hand

Joined: Sep 08, 2012
Posts: 51

Hi Junilu Lacar,
You are right,perhaps there is no particular reliable way to open a new tab in IE(6+) but you should understand that that is exactly why I posted this question here. :-)
I am doing this just because its a client request ,not my personal penchant.
Thanks for searching on the internet on my behalf.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

As a professional, it is your responsibility to tell a client when their request is technically not feasible. If you spend two or three days trying to find a non-existent solution, you are doing your client a disservice by wasting your time and their money.

Why not just make it as training issue then? Tell the client if they want to see the new page on a new tab, right click the link and select the "Open in new tab" option. That's the simplest way I can think of to solve your "problem".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Open a new tab from a servlet
 
Similar Threads
Query about Request Forwarding
enable multiple users login using the same browser in diffrent tabs
Thread-safe on HttpSession Object
Open JSP page in new tab(browser) from request from servlet
jQuery tabs UI issue