File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open JSP page in new tab(browser) from request from servlet

 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi is it possible to open jsp page in new tab(browser) from a servlet. Like if i have a jsp first.jsp it has a link in grid(so many) when user clicks on that link it is going to a servlet say(RequestedLinkServlet)
my code in servlet is

please help me
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the link (or form) to the servlet, use the attribute target="_blank". This will cause the response to appear in a new window or tab as specified by the browser settings.

A few points before you ask:
  • No, you can't just do this from the servlet. It must be specified in the HTML that invokes the servlet.
  • No, you cannot override the browser's setting. If the browser is set to open new pages in a new window, you cannot cause it to open a new tab, and vice versa.
  •  
    Rob Spoor
    Sheriff
    Pie
    Posts: 20381
    46
    Chrome Eclipse IDE Java Windows
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Opening new windows / tabs is a client action, and can be done using the target attribute Bear mentioned or with JavaScript. The only way to trigger it from the server is to open a page that will automatically open a new window / tab using JavaScript.
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic