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.

Example:

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

Context:

JSPX Page

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.

Example:

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

Context:

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.

Example:

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

               ...
           }   
     
</af:resource>

  </af:pageTemplateDef>

Context:

Template Definition JSPX

Reference:
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...