O'Reilly logo

Mastering JavaServer Faces 2.2 by Anghel Leonard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Styling contracts across different devices

In the preceding examples, we saw how to write the JSF contracts and how to use them by explicitly setting them by name in the contracts attribute of the <f:view> tag. Sometimes, you may need to dynamically set a contract (theme); for example, you may need to choose the right contract based on the device type that should display the application (PC, tablet, smartphone, mobile phone, and so on). In this case, you need to provide the contracts attribute value from a managed bean.

It is beyond the scope of this book to provide a powerful code (or algorithm) for detecting device types, resolutions, and so on. With minimum involvement in the mobile area, we will try to write a JSF application capable of choosing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required