Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Working with component tree before render  RSS feed

 
Denis Oleshkevich
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I need move all JS scripts from tag HEAD to bottom of tag BODY to increase a loading speed of application. How to do this? I trying solve this using PhaseListener, but can't understand how working with component tree from this scope.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A lot of the renderers in JSF specifically and explicitly indicate what part of the generated HTML they will be output in, whether HEAD, body-start, body-end, or wherever. If you attempt to blindly override them you will probably not like the results.

The best way to increase the loading speed is to keep the content short, which doesn't require any messing around with JSF internals at all. In the case of user-requested JavaScript, making the scripts externally URL-referenced instead of in-line may help.

For some frameworks such as RichFaces, the server synthesises a client-specific script and uses the same script as an external URL reference for all of the client's RichFaces pages. So ensuring that this script is cached on the client can be a major performance boost. This isn't as easy as it seems, however, since some webapp servers such as Tomcat disable caching for secured items and have to be persuaded to re-enable caching.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!