Search This Blog
Monday, June 25, 2012
Sunday, February 26, 2012
Embed / RUN Flash Movie in a JSPX Page ADF Application
Blog Post Dedicated to Udit Sharma.
Hi,
Trying to run a flash movie in a jspx page of an adf application came up with issues when you call the flash movie from the page itself.
To overcome this, we need to embed this flash movie in the jspx page.
This post of mine shows Embedding and running a flash movie (.swf) in a jspx ADF page. My colleague Udit Sharma found out a ingenious and simple way of achieving this.
First we need the <object> (The OBJECT element is used to include objects such as images, audio, videos, Java applets, and Flash animations. OBJECT is intended to replace the more specific IMG and APPLET elements, as well as the proprietary EMBED and BGSOUND elements, though a lack of browser support and severe bugs in supporting browsers make the other elements a better choice in many cases.).
To create this, we write the following code, which returns the string, used to embed the flash movie in the jspx page. In my case, I am embedding a RSA flash movie in my jspx, an ADF application.
Following is the code example:
public String getFlashObjectForFirefox() {
System.out.println("inside getFlashObjectForFirefox");
String ctxPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
System.out.println("ctxPath is " + ctxPath);
String object = "";
object = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" \n" +
"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\n" +
"=10,0,0,0\" width=\"100\" height=\"100\" id=\"11gR1_aniH_grey\" align=\"middle\">\n" +
"<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n" +
"<param name=\"allowFullScreen\" value=\"false\" />\n" +
"<param name=\"wmode\" value=\"transparent\" />\n" +
"<param name=\"movie\" value=\""+ctxPath+"/rsa_fso.swf\" />\n" +
"<param name=\"quality\" value=\"high\" />\n" +
"<param name=\"bgcolor\" value=\"#4d5c64\" /> \n" +
"<param name=\"flashVars\" value=\"field_name=deviceString\"/>\n" +
"<embed id=\"flash_id\" " +
"src=\""+ctxPath+"/rsa_fso.swf\" quality=\"high\" width=\"100\" height=\"100\" name=\"rsa_fso.swf\" align=\"middle\" \n" +
"type=\"application/x-shockwave-flash\" flashVars=\"field_name=RSADeviceFso\" wmode=\"transparent\"\n" +
"pluginspage=\"http://www.adobe.com/go/getflashplayer\" />\n" +
"</object> ";
return object;
}
Now, from the .jspx page, I use the following tag to include and run the flash movie:
<f:verbatim>
${pageFlowScope.UIBean.getFlashObjectForFirefox}
</f:verbatim>
Please note that using the ctxPath, I have mentioned the path to the flash movie and the other javascripts required for the proper functioning/running of the flash movie.
Hope this helps.
Sudipto S.
P.S : Follow me with my progress on Java Knowledge and Black Belts come to knowledgeblackbelt.com
Hi,
Trying to run a flash movie in a jspx page of an adf application came up with issues when you call the flash movie from the page itself.
To overcome this, we need to embed this flash movie in the jspx page.
This post of mine shows Embedding and running a flash movie (.swf) in a jspx ADF page. My colleague Udit Sharma found out a ingenious and simple way of achieving this.
First we need the <object> (The OBJECT element is used to include objects such as images, audio, videos, Java applets, and Flash animations. OBJECT is intended to replace the more specific IMG and APPLET elements, as well as the proprietary EMBED and BGSOUND elements, though a lack of browser support and severe bugs in supporting browsers make the other elements a better choice in many cases.).
To create this, we write the following code, which returns the string, used to embed the flash movie in the jspx page. In my case, I am embedding a RSA flash movie in my jspx, an ADF application.
Following is the code example:
public String getFlashObjectForFirefox() {
System.out.println("inside getFlashObjectForFirefox");
String ctxPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
System.out.println("ctxPath is " + ctxPath);
String object = "";
object = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" \n" +
"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\n" +
"=10,0,0,0\" width=\"100\" height=\"100\" id=\"11gR1_aniH_grey\" align=\"middle\">\n" +
"<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n" +
"<param name=\"allowFullScreen\" value=\"false\" />\n" +
"<param name=\"wmode\" value=\"transparent\" />\n" +
"<param name=\"movie\" value=\""+ctxPath+"/rsa_fso.swf\" />\n" +
"<param name=\"quality\" value=\"high\" />\n" +
"<param name=\"bgcolor\" value=\"#4d5c64\" /> \n" +
"<param name=\"flashVars\" value=\"field_name=deviceString\"/>\n" +
"<embed id=\"flash_id\" " +
"src=\""+ctxPath+"/rsa_fso.swf\" quality=\"high\" width=\"100\" height=\"100\" name=\"rsa_fso.swf\" align=\"middle\" \n" +
"type=\"application/x-shockwave-flash\" flashVars=\"field_name=RSADeviceFso\" wmode=\"transparent\"\n" +
"pluginspage=\"http://www.adobe.com/go/getflashplayer\" />\n" +
"</object> ";
return object;
}
Now, from the .jspx page, I use the following tag to include and run the flash movie:
<f:verbatim>
${pageFlowScope.UIBean.getFlashObjectForFirefox}
</f:verbatim>
Please note that using the ctxPath, I have mentioned the path to the flash movie and the other javascripts required for the proper functioning/running of the flash movie.
Hope this helps.
Sudipto S.
P.S : Follow me with my progress on Java Knowledge and Black Belts come to knowledgeblackbelt.com
Thursday, February 2, 2012
Calling Web Service From A Web Center Portal Application
Hi Friends,
Recently in a project, I needed to call a Web Service from a Web Center Portal Application. After a few errors, I was successfully able to call the web service from the application.
I will discuss the same with you here. Let me brief about the components involved in this discussion, i.e
1. The java method that will be invoked via a web service call, which is independently hosted in an external server space. This java method (exposed through a web service call) requires a argument and returns an String as output. (Note: The return type of the web service call is something different from that of the return type of the java method itself).
2. The web center application is a simple Web Center Portal Application and on a successful login, the user is rendered some page which contains the output of the java method call via web service.
I am using Oracle ADF 11.1.1.5.0 for this purpose.
First of all we need to create the Data Controls for the web service. Following is how you create the Data Control for the web service:
Click on the portal project and say New..
Then in the Business Tire > Web Services select Web Service Data Control.
Click Ok.
Name the Data Control in the Name: section.
Provide a valid WSDL url to the web service which the portal application would call.
Click Next.
In the data control operations, select the method that you want to call as a web service and add to the selected section.
Click Next.
You can click Finish at this point to create the Data Control. On successful creation of the Data Control, you would find the Data Control with the method to be called in the Data Controls section, as follows:
Now that the Data Control is created, we need to call this web service internally, without any user intervention and also passing a parameter to the web service call. To make the call, you need to drag the method in the Data Control to a task flow and declare the activity as the default activity.
In the data control section, select the data control for the web service:
Double click to pass the parameters to the method calls:
Drag the data controls to the task flow of your application:
You can also mention the return value of the method call, depending on your application requirement.
Execute the task flow and the application will make the web service call.
Thank you.
Follow me with my progress on Java Knowledge and Black Belts come to knowledgeblackbelt.com
Subscribe to:
Comments (Atom)