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

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

mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

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

Joined: Jan 10, 2002
Posts: 61434
    
  67

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.


  • [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    Rob Spoor
    Sheriff

    Joined: Oct 27, 2005
    Posts: 19722
        
      20

    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.


    SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
    How To Ask Questions How To Answer Questions
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Open JSP page in new tab(browser) from request from servlet