How to open my Ireport in new browser tab window

hi
I'm using Jdev v 11.1.2.3.0
Isucced in conneting and calling (ireport) generated report from my adf application in pdf file format
All what I want to do now is to call or open the report in browser tab window
I can call it in the same tab window
using this line code
response.setHeader("Cache-Control", "max-age=0");
or
make attachment download
using this line code
response.setHeader("Content-Disposition", "attachment; filename=\"report.pdf\"");
please help me in this last setp
here is my code to call ireport
after adding nessesary jar files and Datasource in wedlojic
maybe it help others
============
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum;
import net.sf.jasperreports.engine.util.JRLoader;
import oracle.adf.model.BindingContext;
import oracle.adf.view.rich.component.rich.input.RichInputText;
import oracle.binding.BindingContainer;
//import oracle.adf.model.binding.DCIteratorBinding;
public class mainNew {
private RichInputText copyFrom;
private RichInputText copyTo;
public mainNew() {
public void setCopyFrom(RichInputText copyFrom) {
this.copyFrom = copyFrom;
public RichInputText getCopyFrom() {
return copyFrom;
public void setCopyTo(RichInputText copyTo) {
this.copyTo = copyTo;
public RichInputText getCopyTo() {
return copyTo;
public String cb3_action() {
String s =(String)copyFrom.getValue();
String d =(String)copyTo.getValue();
// copyTo.setValue(s);
// DCIteratorBinding empIter = (DCIteratorBinding) getBindings().get("Employees1Iterator");
// String empId = empIter.getCurrentRow().getAttribute("DepartmentId").toString();
Map m = new HashMap();
System.out.println(s) ;
System.out.println(d) ;
// m.put("eployeeId", copyFrom.getValue() );
if (s!=null) {
m.put("whr", "Where department_id ="+s); }
if (d!=null) {
m.put("whr", "Where employee_id= "+d);}
if (s != null & d==null)
{ m.put("whr", "Where department_id ="+s);
if (s==null & d!=null) {
m.put("whr", "Where employee_id= "+d);}
if (s!=null & d!=null) {
m.put("whr", "Where department_id ="+s +" and employee_id="+d);}
if (s==null & d==null) {
m.put("whr", "Where 1=2");}
try
// runReport("empRep2.jasper", m);
runReport("empsDyn.jasper", m);
catch (Exception e)
return null;
public BindingContainer getBindings()
return BindingContext.getCurrent().getCurrentBindingsEntry();
public Connection getDataSourceConnection(String dataSourceName)
throws Exception
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup(dataSourceName);
return ds.getConnection();
private Connection getConnection() throws Exception
return getDataSourceConnection("hrDS");
public ServletContext getContext()
return (ServletContext)getFacesContext().getExternalContext().getContext();
public HttpServletResponse getResponse()
return (HttpServletResponse)getFacesContext().getExternalContext().getResponse();
public static FacesContext getFacesContext()
return FacesContext.getCurrentInstance();
public void runReport(String repPath, java.util.Map param) throws Exception
Connection conn = null;
try
HttpServletResponse response = getResponse();
ServletOutputStream out = response.getOutputStream();
/// response.setHeader("Cache-Control", "max-age=0"); // opens in same page
response.setHeader("Content-Disposition", "attachment; filename=\"report.pdf\""); // genreat adownload file
// response.setHeader("Content-Disposition", "inline; filename=\"" + "Report.pdf\"");//opens in same page
response.setContentType("application/pdf");
ServletContext context = getContext();
InputStream fs = context.getResourceAsStream("/reports/" + repPath);
JasperReport template = (JasperReport) JRLoader.loadObject(fs);
template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
conn = getConnection();
JasperPrint print = JasperFillManager.fillReport(template, param, conn);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(print, baos);
out.write(baos.toByteArray());
out.flush();
out.close();
FacesContext.getCurrentInstance().responseComplete();
catch (Exception jex)
jex.printStackTrace();
finally
close(conn);
public void close(Connection con)
if (con != null)
try
con.close();
catch (Exception e)
}

One solution would be to generate the report via an servlet which you then call with an af:golink with an target frame set to blank.
For a sample how to do this check out http://tompeez.wordpress.com/2011/12/16/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-3/
Timo

Similar Messages

  • Embedded hyperlink into new browser tab/window

      Hi Team,
    There is a requirement in my project for that, need to open embedded hyperlink into new browser tab/window, hyperlink is available in the pdf file which is open in browser (Internet Explorer).
    More than 2 lakh user is using the product so, there is any way to set the hyperlink target as a _blank so that the link open in new tab/window.
    Is there any adobe API is there which can support the above requirement?
    Is there any other way which can fulfill the requirement?
    End user is more than 2 lakh so, am not going to change the setting of Adobe reader as well as browser.
      Need your help to resolve the issues.
    Regards,
    Rupesh

    Yes, there is an API that is supposed to do this in the Web brower.  Does it work?  Not reliably is what I have found because different web browsers seem to interpret the way that Acrobat calls for a new window differently.
    launchURL
    7.0
    S
    Launches a URL in a browser window.
    Note:    Beginning with Acrobat 8.1, File and JavaScript URLs can be executed only when operating in a privileged context, such as during a batch or console event. File and JavaScript URLs begin with the scheme names javascript or file.
    Parameters
    cURL
    A string that specifies the URL to launch.
    bNewFrame
    (optional) If true, this method launches the URL in a new window of the browser application. The default is false.
    Returns
    The value undefined is returned on success. An exception is thrown on failure.
    Example 1
        app.launchURL("http://www.example.com/", true);
    Example 2
    Add an online help item to the menu system. This code should be placed in a folder-level JavaScript file, or executed from the JavaScript Debugger console.
        app.addMenuItem({
            cName: "myHelp", cUser: "Online myHelp",
            cParent: "Help",
            cExec: "app.launchURL('www.example.com/myhelp.html');",
            nPos: 0
    Related methods are openDoc and the Doc object getURL method.

  • How to Open Hyperlink in a New Browser?

    Hi, 
    I have a hyperlink in my report that takes the user to a webpage and from my ASP application, I want the hyperlink to open a new browser session or tab instead of taking over my current session and losing my report.  This will give the users the ability to flip back to the report and open another page if they need to. 
    Interesting how right-clicking the hyperlink has Open in New Tab and Open in New Window greyed out. 
    Windows application works fine and the hyperlinks open in their own tab. 
    Is there a way to encapulate the url from the hyperlink in a javascript popUp? 
    I'm using CRVS2010 in VS2010. 
    Thanks,
    Brian

    Hi Brian,
    On the properties page of the view find the Property HyperlinkTarget, default is set to _self, change it to _blank.
    Have fun
    Don
    PS - Thanks to Dan P. For this.

  • OPENING A NEW BROWSER TAB/WINDOW WITHOUT NAVIGATING TO IT

    Hello there,
    I am using flex navigateToUrl( urlRequest, "_blank"); function to open a new browser window. What it does is it also navigates to newly opened window by default. I want to remain in the same page, but still open this new window without focusing it.
    Is there a way to do that
    Thanks.

    I would update your Adobe PDF plug-in first - it is 10.1.7.x and my version says 11.3.x) To do this, go to the [http://mozilla.com/plugincheck Mozilla Plugin Check site].
    Once you're there, the site will check if all your plugins have the latest versions.
    If you see plugins in the list that have a yellow ''Update'' button or a red ''Update now'' button, please update these immediately.
    To do so, please click each red or yellow button. Then you should see a site that allows you to download the latest version. Double-click the downloaded file to start the installation and follow the steps mentioned in the installation procedure.

  • How to open a url in new page/tab from Answers passing a value to the url in OBIEE10g

    Hello All,
    I'm trying to create an answer, A column "request id" would have a url with request id attached to end of url to open a web page. I did get the answer working, I need to open the webpage in a new page rather than in the same obiee answer. We are on OBIEE10g(10.1.2.3) on Windows 2003 R2.
    Can anyone give me some information to achieve this ?
    Thanks,
    Vijay

    Hello Srini, Vinod,
    I guess there might some set-up issue here. Here is my link
    <a href="https://ifa.dev.com/inspectionformsweb/formviewer.aspx?formid=273221" target=_new>273221</a>
    If I give the above link I would get syntax error.
    Then I change to add single quotes on the above link
    '<a href="https://ifa.dev.com/inspectionformsweb/formviewer.aspx?formid=273221" target=_new>273221</a>'
    Output looks like
    273221"><a href="https://ifa.dev.com/inspectionformsweb/formviewer.aspx?formid=273221" target=_new>273221</a>
    On the number when I click it does not go to the link rather gives me a HTTP 404 not found
    http://scaobieedev:9704/analytics/%3Ca%20href=
    Please advice.
    Thanks,
    Vijay

  • When you open a new browser tab, underneath the box to type in what you are looking for is the recently visited list. I want to disable or delete this list...how do I get rid of this list???

    When you open a new browser tab, underneath the box to type in what you are looking for is the recently visited list. I want to disable or delete this list...how do I get rid of this list???

    The drop-down list displays items from your History and/or Bookmarks.
    You can control what shows (or nothing at all): Options > Privacy, "Location Bar" section. Options are:
    *History and Bookmarks
    *History
    *Bookmarks
    *Nothing
    See --> https://support.mozilla.com/en-US/kb/Options%20window%20-%20Privacy%20panel
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.com/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.com/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.com/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • I can no longer open a new browser tab by either clicking the + at the end of the last browser or by using the Ctrl key + T, how do I fix this?

    I have uninstalled firefox and reinstalled firefox to try and solve this
    issue, but it has not fixed the issue. To open a new tab I must right click
    any current page link to get a new browser tab and then navigate to a new web address. This is a recent issue that just started happening and I can't figure out what happened or what got disabled. Please help me fix this.

    Try uninstalling the Ask toolbar and it should work again. There is a compatibility issue with the Ask toolbar and Firefox that prevents new tabs from being opened.

  • Open in a New Browser Tab?

    How do I open in a new browser tab (ex. IE & Firefox)? I
    know how to open in a new window but cannot fins a command or code
    to point to a new browser tab.

    That's because it doesn't exist as far as I know. There is no
    code like <a href ="xxx.com" target="_newTab">.
    That is just an option the user can choose by right clicking
    on a link and selecting "Open Link in a New Tab".
    Just treat the content like it is opening in a new window.
    You can name the new page and then focus in on it as if it is not
    in a tab but a new window.

  • Opening a servlet in new browser window

    Does anyone know how you can make a servlet open in a a new browser window when clicking a link for that servlet.
    cheers

    Hi..
    do
    window.open("http://localhost:8080//yourservlet-path//servlet-name");
    you can also set window properties, they are passed as parameters to window.open
    see syntax of window.open. but this thing will open your servlet in a new window with default properties.

  • Open Bytearray in new browser tab??

    hi
    I get the content of a file from the database and I want to open the content in an new browser tab.
    The content will be send to the frontend as bytearray.
    What kind of formats could be shown in a browser tab (e.g.: DOC, PDF, EXCEL)?
    is it possible to open a new browser tap to show a bytearray file? How??
    I just found only the possibility to open a pdf with e.g. a coldfusion script.
    I don't use a coldfusion server or something like that.
    How could I do this in PHP. I never used PHP.
    thanks for any advice

    Try this technique in a managed bean method that is invoked by your <af:commandLink>:
    // Invoke your PL/SQL procedure
    // Open the APEX site in a separate browser window
    String apexUrl = ...;
    ExtendedRenderKitService erks = Service.getRenderKitService(ctx, ExtendedRenderKitService.class);  
    String script = "window.open('" + apexUrl + "', '', 'location=0, status=0, resizable=1, scrollbars=0');";
    erks.addScript(FacesContext.getCurrentInstance(), script);Dimitar

  • Link which should open up on a new browser

    Hi,
    I need to create a link on a self service page through OA frame work. My requirement is that when the user clicks on the link the new page should open up into a new browser. The link is embedded in a tip on the message. The tip is actually a AOL message.
    It should look like this...
    Tip: ----------------------------------------------------------------------------------------------------------.Click HERE to view.
    HERE should be the link to the new page.
    When I try to incorporate the blank or new tags in the html tags in the messgae itself and call it in JDEV...in the TIP...new page opens up in the same window.
    Have tried creating a LINK ITEM. But Placing the link ITEM on the page seems difficult. Are their attributes which control the placing, Fond, color of such LINK ITEMS?

    Welcome to the forums !
    Pl post your OS and EBS versions. Pl see if MOS Doc 416705.1 (How to Create Link With Customized CSS Style to Open a New Window?) can help
    HTH
    Srini

  • Open URL from Java in a new browser tab

    Hi OTN,
    Surprisingly can't find the implimintation.
    In an ADF managed bean I retrieve String url. I need to open a new browser tab with this url.
    Found this thread Open a url in a new window in the backing bean which shows using javascript "service.addScript(facesContext, "window.open(http://www.google.coml)");".
    But in my case in doesn't work. The code is executed, but nothing happens. Maybe because the bean is called from a taskflow inline popup.
    ADF 11.1.1.4
    Thanks.

    Well, I'm afraid that is not an option.
    The goButton is in a table row. There are lots of rows so if I use EL for Destination attribute the URL would be retrieved for each of rows.
    The method of URL retreiving is heavyweight operation which includes calling plsql functions, working with strings and others. So if I do it for each table row my application hungs and then I receive an exception of CPU usage.
    That's why I switched to normal commandButton witch actionListener which retrieves url on click - only once. So I need to open URL from Java.

  • How to display PDF in a new browser?

    Hi guys,
    I have generated PDF using adobe life cycle manager (transaction SFP) in WDA. Now the requirement is to show the PDF in a new browser. Both views are in the same WD object. I have tried different methods to get the PDF data into the new window which i am opening using method:
    lo_window_manager->create_external_window
    I have the common context through component controller but the data does not reach the second view. I am guessing it is not possible to share same context if you open a new browser.
    Next i tried saving the pdf in a controller class but even then i dont get the data back. The data does get stored through the set functionality.
    I also tried using cl_bsp_server_side_cookie=>set_server_cookie and get_server_cookie methods and still i did not get any data.
    I also tried adding the pdf data into the url and created an inbound plug in the second the view where i needed the pdf data. That url was then sent in the method create_external_window. That did not work out because pdf data is too long to be added as url parameter.
    Any other suggestion. Any suggestion or code will be appreciated.
    Thanks

    > I am guessing it is not possible to share same context if you open a new browser.
    That is correct.  New browser/external window, means new backend session.
    Is this PDF interactive - or just print/view?  If it is just print/view why not consider sending it out as an attachment and then it will open in a separate Adobe Reader window.
    cl_bsp_server_side_cookie=>set_server_cookie and get_server_cookie should work if you fill the parameters correctly.  All these methods do is to write the data in to a temporary database table.  Are you filling in the session id parameter?  If so where are getting the value for this?

  • How to download blob image, inline to new browser tab or window

    APEX V4.2.3
    I have an interactive report with a blob download column which is set to inline.  When I click on the "download" link the image appears automatically in same window as the APEX application.  How do I download the image into a new browser tab?  I need to squeeze 'target="_blank" ' somewhere but I don't know where as the link structure is hidden.
    Here is the code for my download column in the Interactive Report.
    select
    decode(nvl(dbms_lob.getlength(BLOB_CONTENT),0),0,null,
    '<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '||
    'src="'||
    apex_util.get_blob_file_src('P98_BLOB_CONTENT',image_id)||
    '" height="100" width="100" alt="'||FILENAME||'" title="'||FILENAME||'" />')
    as detail_img,
    from "#OWNER#"."TIS_ATTACHMENTS"
    thanks in advance
    PaulP

    I would suggest
    SELECT ID, NAME,CASE WHEN NVL(dbms_lob.getlength(document),0) = 0
      THEN NULL
      ELSE CASE WHEN attach_mimetype like 'image%'
      THEN '<img src="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'" />'
      ELSE
      '<a  target="_blank" href="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'">Download</a>'
      end
      END new_img
      FROM TEST_WITH_BLOB

  • On Firefox 4, the back button does not work on a new browsing tab or window.

    Ever since I installed Firefox 4, I have noticed a problem that was not present with the previous version of Firefox. Whenever I open up Firefox and enter in a new web address, I cannot use the back arrow to go back to my original homepage; the arrow is ghosted out. The same problem exists when I open up a new browsing tab. Let me explain with an example. I open up my browser, and then I open a new tab (now there are two tabs open). In the new tab I type www.espn.com. Then I click on a link on espn.com. Say then I want to go back to the espn.com homepage that I just previously visited. I can't do it by clicking the back arrow; it's ghosted out. I have to physically type the address again (www.espn.com). Why has this changed? Is there a way to fix it? Why can't I just click the back arrow to go back to the espn.com homepage that I typed in originally (or my original homepage if I opened up a new window instead of a tab)? Oddly enough, if I go one link deeper into the espn.com site, I can then go back to the immediately preceding webpage, but not all the way back to the original espn.com homepage.
    I can't stand IE, but it doesn't have this problem. This problem also was not present on the old version of Firefox. I just verified this by testing the old version which I have installed on another computer.
    Please advise.

    Same problem here: I never had a problem with the previous versions and now I don't even get my homepage when I click Firefox. Instead, I am getting a blank screen that says "New Tab", only after I click the "Home" symbol I get my Homepage (Yahoo). The browser - back and browser forward button don't work anymore, very annoying. Normally a newer version should be an improvement but it looks like Mozilla really messed up with this "improvement". probably I am going to use Google chrome from now on.

Maybe you are looking for