I've found a way to combine components to new tags.
There was already some discussion on a similar topic:
http://www.mail-archive.com/users@myfaces.apache.org/msg06438.html
http://www.mail-archive.com/users@myfaces.apache.org/msg06369.html
My first approach was to write a tag file (JSP 2.0) like
(this is a non-working short-sample):
file: inWithLabel.tag
<%@ attribute name="label" %>
<%@ attribute name="value" %>
<%@ attribute name="binding" %>
<t:panel>
<t:label value="${label}">
<t:in value="${value}" binding="${binding}">
</t:panel>
The first tests with "label" and "value" run well.
But I found a big problem: If I want more advanced features like
"binding" I have a problem: If the binding is not set the container will
call setBinding("") with an empty string, which is not allowed.
So I write the Tag by hand:
int doStartTag() {
PanelTag panel = new PanelTag();
panel.setPageContext(pageContext);
panel.doStartTag();
...
}
You can see a real sample here:
http://www.atanion.net/repos/asf/tobago/trunk/core/src/main/org/apache/myfaces/tobago/taglib/extension/InExtensionTag.java
advantage of tag as java class:
* Works with JSP 1.2
* not need rtexpression (JSP EL) inside of JSF tags, which is in
common not allowed.
* setter only will be called, if the value != null
advantage of tag file:
* the tag file looks much more tidy
Regards,
Udo