Saturday, March 13, 2010

Oracle PDK Portlet/ FLEX (Request Parameter from a Portlet to swf file)

I had an Requirement to pass my OID userName to a PDK/Flex Portlet. (I have my employee ID as the OID userName) and as always i want that to default in the userName Field of My shockWave File (.swf)

Environemnt: Flex 3.2/ oracle Portal 10.1.4

Steps.

1. Create you Flex app .have a shock wave file ready.

2.Make Sure you have the below Code to Access your request Parameter

empName = Application.application.parameters.empName;

3. upload the files(history.css,AC_OETags.js,history.js) to a portal page group.you can User Oracle Drive , any WebDav Client or just upload manually.

for eg:

/portal/page/portal/ABCIntranet/js/AC_OETags.js
/portal/page/portal/MCSIntranet/css/history.css
/portal/page/portal/MCSIntranet/js/history.js

3.Create a Portlet using the Standard Wizard. on the Show Mode Jsp. Paste the below Code


<%
String empName = null;
empName = request.getHeader("x-oracle-cache-user") ;
%>


4. in the div tag where you embed the flash file make sure you are passing the FlashVars Parameter with the String Value(in this case i used empName).


eg:



embed src="/portal/page/portal/ABCIntranet/swf/Flash1.swf" quality="high" bgcolor="#ffffff" FlashVars ='empName=<%=empName%>'



4.Register,Publish your Portlet.

Thanks
Prem

No comments: