-
1. Re: Javascript included for non-rendered components
nbelaevski Feb 18, 2009 9:37 AM (in response to tobz67)Hello,
Yes, that's a type of "feature". As a workaround you can use c:if tags that won't create components if they're not necessary. Please reply if this is acceptable for you or not. -
2. Re: Javascript included for non-rendered components
tobz67 Feb 18, 2009 11:11 AM (in response to tobz67)Thank you for the reply and the suggestion. I tried it and that does solve my problem.
That does seem like a bug more than a feature though. Maybe I'm misunderstanding the intent of the render flag, but it seems to me that's the entire reason for having it - don't include this component (and any related JS or CSS) when creating output for the client request.
Perhaps it's not the best approach to have basic HTML tables and Richfaces tables in the same xhtml page and simply toggle which one is rendered based on the user agent type. However, that seems like one of the strengths of JSF and Richfaces - keeping the markup in one page and simply toggle the content based on browser capabilities. Especially in this case where two non-rendered components increase the page weight by over 270K with Javascript. Seems that a web technology should be a little more conscious of download performance.
Thanks again for your help! -
3. Re: Javascript included for non-rendered components
alexsmirnov Feb 18, 2009 7:37 PM (in response to tobz67)This is HTML-specific feature. Sometimes even not possible to append additional styles and scripts after page have been loaded. For example, document.write method dos not work after page loading, frameworks like jQuery requires "onload" event and so on. Since early ajax4jsf we collect all resources required by components even though component itself does not rendered.
Really, content-depended design with a lot of conditions omit base MVC pattern. For these tasks much better to create different pages for a different agent types and switch them from one controller. In this case you can use even different render kit implementations to adopt your site design for an any type of client.