Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to select a render kit at request-time?  RSS feed

Bryan Basham
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I know that JSF supports multiple "render kits", but I have done little research on this topic. [The book I have _JSF in Action_ does not cover this topic in very much depth.]

As we all know, various browsers support CSS and JavaScript to varying degrees. Our UI designers are creating custom components, but are having to jump through gnarly hoops to make a single set of JS code work for all of the browsers we need to support (Firefox v1.5 and v2.0 and IE v6 and v7). I have proposed that we could simplify this by creating render kits for each browser type that generates *only* the necessary JS code that works for that specific browser.

The idea sounds good, but the one thing I don't understand is this: How does JSF know which render kit to use for a given HTTP request? Clearly, the User-Agent request header should be used to identify which browser is being used by the user, but how does JSF know about the mapping between the User-Agent data and the appropriate render kit?

I imagine that I will need to create a hook somewhere to tell JSF for a given request which render kit to use. But what is the appropriate hook? Do I need a custom PhaseListener? Do I need a custom ViewHandler?

Does anyone have a URL to a resource that solves this problem?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!