Thursday, May 17, 2012

Call Oracle Reports From Your ADF Application (Hide Report Parameters From URL)

Hello ADF Developers,

In my previous post http://sameh-nassar.blogspot.com/2010/07/call-oracle-reports-from-your-adf.html I explain a way to call oracle report but this way has a problem. The problem is the report parameters appear in the URL. In this post I will explain another way to call oracle report without displaying report parameters in URL.
to call oracle report follow this steps:
1- Make a new .jsp page (for example the page name is  report.jsp).

2- In faces-config.xml make a navigation rule to report.jsp with outcome "report".

3- Write this code inside the report.jsp page







http://serverIP:port/reports/rwservlet" method="post" id="form1">


 

username/password@orcl" name="userid" size="100">




4- In the button action which will call the report write this code:
    Map map = new HashMap();
    map.put("parameter1", "value");
    map.put("parameter2", "value");
    map.put("report", "reportName.rdf");// name of the report
    FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("reportMap", map);
    return "report";// report outcome
5- Good luck :)

9 comments:

  1. great post , sameh
    yours
    amr ismail

    ReplyDelete
  2. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

    Alena

    Diverticulitis Treatment Diverticulitis Diet

    ReplyDelete
  3. Thank you , Sameh
    Very nice topic.

    Mahmoud Ahmed

    ReplyDelete
  4. Sameh Thank you very much for post it works perfectly. I have a question though, how to open the report in a new page or tab and not the same one as the application.
    Any help please

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Hi Mohamed,
      you can add a af:clientListener inside the button call a script method. as :

      af:commandButton text="runReport" id="cb1">
      af:clientListener method="newWindow" type="action"/>


      newWindow is a script method like:
      function newWindow()
      {
      document.getElementById("yourFormId").target = "_blank;targetfeatures=toolbar=no location=no directories=no menubar=no";
      }
      Regards

      Delete
  5. I must appreciate your post which is helping us in such a great manner.
    free 0800 numbers

    ReplyDelete