File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes How to select a render kit at request-time? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to select a render kit at request-time?" Watch "How to select a render kit at request-time?" New topic

How to select a render kit at request-time?

Bryan Basham
Ranch Hand

Joined: Apr 30, 2001
Posts: 199
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?

I agree. Here's the link:
subject: How to select a render kit at request-time?