use t:inputText value="..." displayValueOnly="#{not bean.inEditMode}"

You switch action can then simply change the value of bean.inEditMode to true. It can even be made with <h:selectOneBoolean immediate="true" value="#{bean.inEditMode}"/>

If you have heavy requirement for a text output with a side icon to edit and don't want the trouble of having to create a boolean property bean for each input text, you can create your own custom component that does it. Creating custom component is not very difficult in jsf. (A bit more if you use jsp view handler because you will also have to write the taglib :p)

rosanil a écrit :
Hi ,
I have a requirement where I need  to show a field in readonly state, very
much like how t:outPutText will show a field. There will be a small edit
icon beside that field which will make the field editable, essetially an
t:inputText will come up.

I know I can do this by going to bean and toggling from t:outPutText to
t:inputText on click of edit. But I was curious about "displayValueOnly"
attribute of t:inputText. Can this attribute really work for above purpose?
Actually it will good if I wouldnt have to go to bean for this small thing.

Any pointers will be a big help.
Thanks!

Reply via email to