|
List Info
Thread: JSR-252 Issue 21 - Provided an additional "binding" attribute for the core Converter, Listener an
|
|
| JSR-252 Issue 21 - Provided an
additional "binding" attribute
for the core Converter, Listener an |

|
2007-10-15 14:16:16 |
|
Hi
Reading the documentation of jsf-1_2-mrel-spec.pdf, says on section 9.4.5, <f:converter>
"..... The implementation class for this action must meet the following requirements:
* Must extend javax.faces.webapp.ConverterJspTag.
* The createConverter() method must:
If binding is non-null, call binding.getValue() to obtain a reference to the
Converter instance. If there is no exception thrown, and binding.getValue()
returned a non-null object that implements javax.faces.convert.Converter,
register it by calling setConverter(). If there was an exception thrown, rethrow
the exception as a JspException.Use the converterId attribute if the converter
instance could not be created from the binding attribute. If the converterId
attribute is set, call the createConverter() method of the Application
instance for this application, passing converter id specified by their converterId
attribute. If the binding attribute was also set, store the converter instance by calling
binding.setValue(). Register the converter instance by calling
setConverter(). If there was an exception thrown, rethrow the exception as a
JspException. "
Something similar for f:validator and f:actionListener
The problem is that the actual JSF RI does not do what in spec says to do, but JSF RI has a correct behaviour
I have this example:
bindingCLV.jsp
<% page session="false" contentType="text/html;charset=utf-8"%>
<% taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<% taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
<f:view beforePhase="#{bindingCLVBean.beforePhase}"
afterPhase="#{bindingCLVBean.afterPhase}">
<% include file="inc/head.inc"%>
<body>
<f:loadBundle
basename="org.apache.myfaces.examples.resource.example_messages"
var="example_messages" />
<h1>Myfaces Examples JSF 1.2 Additions</h1>
<h:messages></h:messages>
<h:form id="form">
<h:panelGrid id="grid" columns="3">
<h:outputLabel value="BigInt" for="bigint"></h:outputLabel>
<h:inputText id="bigint" binding="#{bindingCLVBean.input1}" value="#{bindingCLVBean.bigint}">
<f:converter converterId="javax.faces.BigInteger" binding="#{bindingCLVBean.converterBigint}"/>
<f:validator validatorId="org.apache.myfaces.bindingCLV.DummyValidator"
binding="#{bindingCLVBean.validatorBigint}"/>
</h:inputText>
<h:message for="bigint"></h:message>
<h:outputLabel value="BigDecimal" for="bigdecimal"></h:outputLabel>
<h:inputText id="bigdecimal" binding="#{bindingCLVBean.input2}" value="#{bindingCLVBean.bigdecimal}">
<f:converter converterId="javax.faces.BigDecimal" binding="#{bindingCLVBean.c | |