• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open a new tab from a servlet

 
Vivek Kr Agrawal
Ranch Hand
Posts: 51
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Om Prakash Bijawat
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't matter if the servlet redirects or not in this case.
 
Vivek Kr Agrawal
Ranch Hand
Posts: 51
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vivek Kr Agrawal
Ranch Hand
Posts: 51
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic