Apache MyFaces
Project Documentation
Foundation

Attributes

Tags has attributes. Attribute behavior is different from a property, so it is necessary to use a different annotation/doclet to use it. Usually tags are written by users, but has few attributes and does not have a complex hierarchy, so it is not necessary make tags inherit attributes from other tags.

The objective of use @JSFJspTag and @JSFJspAttribute annotation/doclet is make easier keep synchronized the .tld file with the tag class.

Attribute loaded from basic type

On jsf 1.1 and in some special cases, no ValueExpressions are allowed on some attribute.

    /** 
      * On tlds this is translated to something like:
      *
      * <attribute>
      *    <description><![CDATA[Some description]]></description>
      *    <name>var</name>
      *    <required>false</required>
      *    <rtexprvalue>false</rtexprvalue>
      *    <type>java.lang.String</type>
      * </attribute>
      *
      */
    @JSFJspAttribute
    public void setVar(String var)
    {
        // .... some code ....
    }

Attribute loaded from ValueExpression

There are two cases

    /** 
      * On jsf 1.1 this translates to something like:
      *
      * Works on version 1.0.2, but some jsf 1.2 tld templates translate it to:
      * 
      * <attribute>
      *    <description><![CDATA[The fully qualified class name of the ActionListener class.]]></description>
      *    <name>type</name>
      *    <required>false</required>
      *    <deferred-value>
      *        <type>java.lang.String</type>
      *    </deferred-value>
      * </attribute>      
      *  
      * On version 1.0.3 this should be translated to something like:
      * 
      * <attribute>
      *    <description><![CDATA[The fully qualified class name of the ActionListener class.]]></description>
      *    <name>type</name>
      *    <required>false</required>
      *    <rtexprvalue>true</rtexprvalue>
      * </attribute>
      * 
      * But this depends on the template used to generate its tld.
      **/
    @JSFJspAttribute(className = "java.lang.String", rtexprvalue = true)
    public void setType(ValueExpression type)
    {
        // .... some code ....
    }
    
    /**
      * Works on version 1.0.3 and upper for jsf 1.2 and upper tld templates:
      *
      * <attribute>
      *    <description><![CDATA[The fully qualified class name of the ActionListener class.]]></description>
      *    <name>type</name>
      *    <required>false</required>
      *    <deferred-value>
      *        <type>java.lang.String</type>
      *    </deferred-value>
      * </attribute>  
      **/
    @JSFJspAttribute(deferredValueType = "java.lang.String")
    public void setType(ValueExpression type)
    {
        // .... some code ....
    }
    
    

Attribute loaded from MethodExpression

  /** works on version 1.0.3 and upper for jsf 1.2 and upper tld templates **/
  @JSFJspAttribute(required=true,
          deferredMethodSignature = "void myMethod(javax.faces.context.FacesContext, java.io.OutputStream)")
  public void setMethod(MethodExpression method)
  {
    _method = method;
  }