Toppac wrote:
Is it possible to force JSF to read the default style from the xhtml every
time a view is rendered? I muck with the styles of the view root components
on the server side but once I change them, anytime the view is rendered it
keeps those style changes unless I change them on the server side again. I'd
like it if I could reset the style everytime, so that it starts with a
default and then I can modify it based on data on the server side.
No, I don't believe so. When a jsp is processed, and a JSF tag is found it looks to see if the component has already been created (is in the current view). If it is, then it skips the tag. This means that properties on the component only get set from the jsp when the component is first created; if you're modifying them from code then they won't get reset (which is what is desired most of the time). I don't know Facelets but presume the same behaviour occurs.

Every UIComponent has a Map associated with it that can be used to store anything at all (see UIComponent.getAttributes) so maybe your code could store the original style somewhere else when it modifies it, and copy it back when the modification is no longer wanted?

Cheers,

Simon

Reply via email to