I would like my page to be user friendly as much as possible and I have an idea but its a little bit harder in the way I want to solve it.
I’m using primefaces and I would like to have a selectOneMenu element which changes to just an outputText with the value of the selected variable in the selectOneMenu. Anyone have some nifty ideas?
This can be done with ajax and partial rendering. Here is a sketch of my idea (untested and in plain JSF):
And that’s what it does:
The value of
h:selectOneMenuwill be initialized and the menu will be rendered only if it is the initial value.On change of the value, the surrounding panelgroup will be re-rendered, hides the menu and lets the
h:outputTextappear.You need a wrapping panelGroup for this because the outputText is not there at page load. If your form is small you could also
render=@formor any other surrounding container instead. Then you wouldn’t need the wrapper.