4 Replies Latest reply: Jan 21, 2014 8:12 PM by 865185 RSS

How to get page parameter

865185 Newbie
Currently Being Moderated

hi Experts,

 

I am using wcp11.1.1.8, I defined page parameter with portal builder, when I used the following expression in page template, there was no output in my test:

${bindings.myattribute},

${bindings.leftWidth},

Is there any error in my test?

 

Best regards

  • 1. Re: How to get page parameter
    Daniel Merchán Expert
    Currently Being Moderated

    Hi.

     

    If you want to use page parameters in you're template you should inject them as following:

    • In the section of attributes of the page template, add a new attribute
    <af:xmlContent>
          <component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">
            <display-name>Globe Page Template</display-name>
            <facet>
              <description>Facet for content</description>
              <facet-name>content</facet-name>
            </facet>
            <attribute>
              <attribute-name>myAttribute</attribute-name>
              <attribute-class>java.lang.String</attribute-class>
              <default-value>test</default-value>
            </attribute>

              ...

    • When including the pageTemplate in your page then you can use <f:attribute> tag to set a value to the Page Template attributes
    <af:pageTemplate value="#{bindings.pageTemplateBinding.templateModel}"
                             id="pt1">
    <f:attribute name="myAttribute" value="#{bindings.myPageParameter}"/>
    • In your Page Template you can use the attribute as #{attrs.myAttribute}


    I hope it helps.
    Regards.

  • 2. Re: How to get page parameter
    865185 Newbie
    Currently Being Moderated

    hi Daniel,

     

    It worked, thanks a lot!

     

    BTW, is there a document link to show when to use "af:pageTemplate" and when not? for example, it's ok to get an attribute from current portal like this:"spaceContext.currentSpace.metadata.customAttributes", while getting page attribute needs to use "af:pageTemplate".

     

    Best regards

  • 3. Re: How to get page parameter
    Daniel Merchán Expert
    Currently Being Moderated

    Hi!.

     

    The best practice is to have a pageTemplate in order to maintain a consistent Look & Feel and common things (as navigation) between pages of the same Portal.

     

    When using "#{bindings}" you can only access bindings of page or page template dependently where are you using this EL Expression.

     

    In case of manage beans as #{spaceContext} you can use it everywhere without any problem. CustomAttributes of a Space is a way to make a general custom configuration of a specific Portal or change something specific or special depending of these attributes. It can be use in Pages and Page Templates.

     

    About documentation I think that the best one is: http://www.oracle.com/technetwork/middleware/webcenter/portal/learnmore/pagetemplates-1438595.pdf but refers to PS5 version and don't have content about responsive designing for mobile devices.

     

    I hope it helps.

     

    Regards.

  • 4. Re: How to get page parameter
    865185 Newbie
    Currently Being Moderated

    hi Daniel,

     

    This really helps.

     

    Best regards

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points