Wednesday, March 11, 2015

IFrame in ADF Application - Menu and Show Page in IFrame

ADF Applications uses power of reusable task flows to be embed as regions in the page, which can be refreshed based on the use cases.

But there are some requirements by the clients which still emphasize on using Iframe to display different applications inside one application.

Suppose there is a requirement where there are 3 applications A,B and Consuming Application. All three applications A,B and Consuming needs to be deployed as separate EAR(Applications) and Consuming App needs to display the A and B Applications pages inside its main page.

Portal architecture can also fit for this requirement but if there is only ADF you need to implement this, the only choice to do is using Iframe.

In this post I will explain you how we can create a menu and show another application in IFrame in ADF Application.




We will use af:inlineFrame component to achieve this. Below is the use case.

The above diagram is for consuming application and Links in the menu (TestPage1 and TestPage2) refers to another application and the pages on click will open in right hand side inside Iframe.

Lets get started.

Created an ADF Application which has two pages. This will be deployed before the Iframe Application.




Now lets create Consuming Application having Iframe which will be used to display TestPage1 and TestPage2 in Application20 inside it.


IframeTest,jspx has two menu items as well as af:inlineFrame component.




The code is as below .



The page - IframeTest has been divided into two panels using panel splitter. On left hand side there are two commandButtons which have actionListener as a method in managedBean. setActionListener sets the value of URL of TestPage1 and TestPage2 jspx into requestScope.goToLink .

Below is the code for ManagedBean.




And its all done.

Lets first run the Application20 webapp. Run the TestPage1.jspx.

Now after it run the page, IframeTest.jxps in IframeApp application.



Click on TestPage1 menu on left, The TestPage1.jspx (From Application20 adf application deployed) will open on the right in IFrame.



Same happens if we click on TestPage2, TestPage2.jspx is opened.


That's it.

Thanks !



9 comments:

  1. Its a very good post..Its solve my SSO problem for multiple application..

    ReplyDelete
  2. @Tuhin How can it solve the SSO problem ?If the other app url is protected, then the iframe will automatically redirect to login page right if SSO is not enabled between called and calling apps(As the both sessions are different).

    ReplyDelete
  3. Hi Subbu, It has nothing to do with SSO. @Tuhin was just referring one of the problems which consist of multiple application access using single application in Iframe.

    Also to answer your question, If the called and calling apps will be deployed on the same domain , then if a user is logged in into calling application, weblogic will get jsession id in cookie and will keep the user authenticated in called application also and there is no need to re login.

    Have a great day.

    Thanks

    ReplyDelete
  4. Hi Rohan,

    We are trying to invoke ADF applications using inline frame.Theses apps are deployed on different managed servers of the same domain. The parent ADF application is accessed ussing https requests we are getting the following message on firefox browser -

    "To display this message Firefox must send information that will repeat action(such as a search or order confirmation) that was performed earlier." and parent session becomes null.

    When the the request is sent using http, we dont see any issues.

    Can you please suggest if we need to set any paremeters to address this issue?

    Thanks,

    ReplyDelete
  5. When you say parent application you mean the landing application ? It is not rendered in IFRAME? Kindly please provide more details.
    Thanks

    ReplyDelete
  6. Yes. The calling application is the parent application. The called application is in inline frame.

    For example, we have 2 ADF apps(A & B). App A is the landing application that has the inline frame. From App A, App B is called through inline frame.

    We have a left side tree in APP A for navigation and right side work area that is designed with inline frame. When user clicks on any of the menus from the tree, the work area should launch different ADF apps in line frames.

    When APP A is accessed through https request, after clicking on a menu from tree(one of the menus is configured to launch App B), the ADF B app is rendered in inline frame but on browser(Firefox) we see a popup with messgae - "To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier." with Resend and cancel options. When clicked on 'Resend', it throws me back to the login screen. This happens as the session object becomes null.

    For the same use case, if APP A is access through http request, everything works fine and we dont see any issues.

    ReplyDelete
  7. Hi Rohan,
    I am using I Frame same as your use case.Problem here is,on clicking the link, every time a new connection to DB is created and throwing resource pool exception,then I increased max connections in web-logic server,now there is no exception.How to control the number of connections using I Frame .i think
    I FRAME is not recommended in ADF.What you would say?

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete