tags:

views:

320

answers:

1

Details: Willing to define a converter which mask/format the input/output text value of ui-components, with given mask/pattern. However the value stored and displayed is un-formatted/un-masked. Why? What m’I missing? The code is defined as per post http://www.lunatech-research.com/archives/2007/06/13/facelets-date-converter

Snippet:

<h:inputText id="idCust" value="#{testMask.value}">
    <custom:maskConverter mask="***-**-****" />
    <a4j:support event="onblur" reRender="idCust" />
</h:inputText>

Converter:

public class MaskConverter implements javax.faces.convert.Converter, StateHolder{

 /**
     * <p>The standard converter id for this converter.</p>
     */
    public static final String CONVERTER_ID = "adr.custom.Mask";
}

Further, please guide/clarify these:

  1. Towards facelets & JSF, for custom tags do I need to do both, define mycomponents.taglib.xml and config in faces-config.xml?

  2. How to decide when to define custom renderer? Or a converter with properties?