On 2/25/10 3:43 AM, webtier_at_javadesktop.org wrote:
> I'm using JSF 2.0 and I try to use the<f:attribute/> tag.
> The following usage works only for the attribute "title".
>
> <h:inputText id="ioFld">
> <f:attribute name="size" value="#{Integer.valueOf(2)}"/>
> <f:attribute name="title" value="bla"/>
> </h:inputText>
>
> The "size" attribute is not applied. Can any body tell me why?
>
The EL doesn't support the invocation of static methods in this fashion.
You could define an EL function library like:
<facelet-taglib xmlns="
http://java.sun.com/xml/ns/javaee"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facelettag libary_2_0.xsd"
version="2.0">
<namespace>
http://acme.com/integer/functions</namespace>
<function>
<function-name>valueOf</function-name>
<function-class>java.lang.Integer</function-class>
<function-signature>java.lang.Integer valueOf(int)</function-signature>
</function>
</facelet-taglib>
(NOTE: methods define in this manner *must* be static)
Then within the Facelet template you'd import the namespace and invoke
the EL function
<html
...
...
xmlns:if=
http://acme.com/integer/functions> <!-- import the
namespace of the taglibrary with the function -->
...
<h:inputText id="ioFld">
<f:attribute name="size" value="#{if:valueOf(2)}"/>
<f:attribute name="title" value="bla"/>
</h:inputText>
...
</html>
Alternatively, you could define an application-scoped managed bean that
delegates calls to the
static methods on Integer.
> Where can I found a good online documentation on jsf 2.0?
>
http://java.sun.com/javaee/javaserverfaces
> May thanks in advance ... Raffaele
> [Message sent by forum member 'rmerico' (merico_at_less.ch)]
>
> http://forums.java.net/jive/thread.jspa?messageID=388617
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>