blob: fe5b9a76e28b2aa088b6251dcc2e7efda65f0b06 [file] [log] [blame]
~~ Licensed to the Apache Software Foundation (ASF) under one or more
~~ contributor license agreements. See the NOTICE file distributed with
~~ this work for additional information regarding copyright ownership.
~~ The ASF licenses this file to You under the Apache License, Version 2.0
~~ (the "License"); you may not use this file except in compliance with
~~ the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing, software
~~ distributed under the License is distributed on an "AS IS" BASIS,
~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~~ See the License for the specific language governing permissions and
~~ limitations under the License.
------
Attributes
------
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;
}
-------------------