Jyo
Jyo

Reputation: 23

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?

Upvotes: 1

Views: 244

Answers (2)

Jyo
Jyo

Reputation: 23

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>

Upvotes: 1

Hongming Chen
Hongming Chen

Reputation: 36

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"/>

Upvotes: 2

Related Questions