Wednesday, March 31, 2010

Bit #3 - Adding Javascript to a JSPX page

The recommended way to add scripting to your JSPX page is via the metaContainer <facet> tag. You add the metaContainer <facet> within the <af:document> tag. You can group your scripts within the metaContainer <facet> using an <af:group> tag. The actual script should be added within an <afh:script> or a <trh:script> tag. Adding Javascript to your JSPX page by directly placing a <script> tag is not recommended because it could have undesired side effects related to the proper resizing of the components in the page.


<f:facet name="metaContainer">
        <afh:script source="/js/YourJsLibrary.js"/>
           function someFunction()



Tuesday, March 30, 2010

Bit #2 - Setting a bind variable value programmatically

To set the value of a bind variable programmatically, you will need to first get the View Object where the bind variable is defined. Then from the View Object you need to get access to the VariableValueManager via the call ensureVariableManager(). Finally you need to call setVariableValue() on the VariableValueManager to set the bind variable to a specific value. Once all these are done, execute the View Object query with the new bind variable value by calling executeQuery()  on the view as shown below.


        ViewObjectImpl view = this.getSomeView();
        VariableValueManager vm = view.ensureVariableManager();
        vm.setVariableValue("bindVariableName", value);


Application Module Implementation class
View Object Implementation class

Monday, March 29, 2010

Bit #1 - Adding Javascript to a template definition

The proper way to add scripting to a template definition is to add it in a <af:resource> tag of type javascript. This tag resides anywhere inside the template defition tag <af:pageTemplateDef>. Adding scripting to the template definition in any other way, for example by placing it inside a <script> tag, will produce undesired effects related to resizing of components within the template.


  <af:pageTemplateDef var="attrs" id="someId">
      <af:form id="formid">
       <af:resource type="javascript">      
            function someFunction()




Template Definition JSPX

Oracle® Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1) Part Number B31973-04 [Section 19.5 Adding Resources to Pages] 
Related Posts Plugin for WordPress, Blogger...