My scenario is that once a user types in a SSN and clicks on Search, I should display all matching SSN results in a masked
pattern. And once the user has selected an SSN , I should disply the SSN all across the application in a masked pattern ( 123-XX-XXX). Since this is something that is quite repetetive I thought I would create a composite component.
This is xhtml code I created: ssn is a managed bean which has a method mask to format the ssn passed to it. My question is if I can pass the componenets attribute ssnValue to the bean as I am doing below? If not what is the right way to do it ? Thanks for any help in advance.
<cc:interface>
<cc:attribute name="ssnLabel"/>
<cc:attribute name="ssnValue" required="true"/>
</cc:interface>
<cc:implementation>
<h:form>
<h:panelGrid columns="2" id="textPanel">
#{cc.attrs.ssnLabel} <h:outputText id="maskedSSN" value="#{ssn.mask(cc.attrs.ssnValue)}" />
</h:panelGrid>
</h:form>
</cc:implementation>