This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSF and the fly likes set value in a composite component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSF
Bookmark "set value in a composite component" Watch "set value in a composite component" New topic

set value in a composite component

Elizabeth Tom

Joined: Jan 25, 2011
Posts: 2
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:attribute name="ssnLabel"/>
<cc:attribute name="ssnValue" required="true"/>

<h:panelGrid columns="2" id="textPanel">
#{cc.attrs.ssnLabel} <h:outputText id="maskedSSN" value="#{ssn.mask(cc.attrs.ssnValue)}" />
I agree. Here's the link:
subject: set value in a composite component
It's not a secret anymore!