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 - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -