'How to convert Outputtext Value as Password(*****)

I have PIN column in DataTable coming from DataBase(as String). As of now the PIN is visible in DataTable, But it has to be shown as password with Asterix(****) and should be visible by double click then editable, after editing done it should be again Asterix(*****). Is there any way to convert Output text value as Password? I am queit new to Primefaces.

                <p:column headerText="PIN">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="{PinDTO.pin}"/>
                        </f:facet>
                        <f:facet name="input">
                            <p:inputText value="#{PinDTO.pin}"
                                label="Name" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>

Is there any way to convert Output text value as Password?



Solution 1:[1]

You can try to use this tag

<p:password />

For more detailed information you can check the following link https://www.primefaces.org/showcase/ui/input/password.xhtml?jfwid=e4236

<p:password id="toggle" value="#{passwordView.password6}" toggleMask="true" redisplay="true"/>

Solution 2:[2]

This is how i solved.

                <p:column headerText="PIN" style="width:250px;">
                    <p:cellEditor>
                        <f:facet name="output">
                            <p:password id="password" value="#{PinDTO.Pin}"
                                style="border:0px;" redisplay="true" />
                        </f:facet>
                        <f:facet name="input">
                            <p:inputText value="#{PinDTO.Pin}" label="Name" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hongming Chen
Solution 2 Jyo