Class OutputFormat

  • All Implemented Interfaces:
    PartialStateHolder, StateHolder, TransientStateHolder, ValueHolder, ComponentSystemEventListener, FacesListener, SystemEventListenerHolder, EventListener

    public class OutputFormat
    extends HtmlOutputFormat

    The <o:outputFormat> is a component that extends the standard <h:outputFormat> with support for capturing the output and exposing it into the request scope by the variable name as specified by the var attribute.

    You can use it the same way as <h:outputFormat>, you only need to change h: into o: to get the extra support for var attribute. Here's are some usage examples:

     <o:outputFormat value="#{i18n['link.title']}" var="_link_title">
         <f:param value="#{bean.foo}" />
         <f:param value="#{bean.bar}" />
     </o:outputFormat>
     <h:commandLink value="#{i18n['link.value']}" title="#{_link_title}" />
     
     <o:outputFormat value="#{bean.number}" var="_percentage">
         <f:convertNumber type="percent" />
     </o:outputFormat>
     <div title="Percentage: #{_percentage}" />
     

    Make sure that the var attribute value doesn't conflict with any of existing variable names in the current EL scope, such as managed bean names. It would be a good naming convention to start their names with _.

    Since:
    1.2
    Author:
    Bauke Scholtz
    • Field Detail

      • COMPONENT_TYPE

        public static final String COMPONENT_TYPE
        The component type, which is "org.omnifaces.component.output.OutputFormat".
        See Also:
        Constant Field Values
    • Constructor Detail

      • OutputFormat

        public OutputFormat()
    • Method Detail

      • getVar

        public String getVar()
        Returns the variable name which exposes the captured output into the request scope.
        Returns:
        The variable name which exposes the captured output into the request scope.
      • setVar

        public void setVar​(String var)
        Sets the variable name which exposes the captured output into the request scope.
        Parameters:
        var - The variable name which exposes the captured output into the request scope.