jsf - Append CSS style from a bean -


is possible append style during @postconstruct of component, example commandbutton. change style class here no way because need dynamic values.

i tried following resets style of button

uiviewroot root = facescontext.getcurrentinstance().getviewroot(); commandbutton button = (commandbutton)root.findcomponent("form:btn1"); button.setstyle("background-color: red;"); 

you can assign style commandbutton dynamically using expression language:

<p:commandbutton ... style="#{bean.buttonstyle}" ... /> 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - How can I echo out this array? -

javascript - IE11 incompatibility with jQuery's 'readonly'? -