blob: 1e8874c38e27afc12f07b84e3468a828601bb6de [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.
------
Creating Custom JSF Tags
------
Creating Custom JSF Tags
A JSF Tag needs the following elements:
* JSP Tag class.
* Tag entry on tld.
* Facelets Tag Handler class (optional).
* Tag entry on facelets taglib (optional).
Myfaces builder plugin provide annotations/doclets to help users maintain
configuration files. In this way, all information for a tag is just in
one file.
Any tag is registered on facelets taglib if it has a related tag handler.
Usually, custom tag classes should have facelets tag handlers with
similar functions, but on facelets world there is no need to define
properties on a xml file.
Setting up your project
All information related can be found {{{setup.html}here}}.
Configuration files (faces-config.xml, .tld, facelets taglib)
This {{{config-files.html}page}} shows some examples.
Annotate JSF Tag Classes
Just add the annotations/doclets as presented below:
-------------------
@JSFJspTag(
name = "f:valueChangeListener",
bodyContent = "empty")
public class ValueChangeListenerTag extends
GenericListenerTag<EditableValueHolder, ValueChangeListener>
{
/** ............. some code goes here ................. **/
@Override
@JSFJspAttribute(
className = "java.lang.String",
rtexprvalue = true)
public void setType(ValueExpression type)
{
super.setType(type);
}
@Override
@JSFJspAttribute(
className = "javax.faces.event.ValueChangeListener",
rtexprvalue = true)
public void setBinding(ValueExpression binding)
{
super.setBinding(binding);
}
}
-------------------