JavaServer Faces has a reputation for fancy features. It’s integrated with enterprise Java, and there’s plenty of vendor support from the biggest software companies like IBM and Oracle. These factors make it a favorite for businesses that need to be able to do a lot with their apps. Generous third party libraries, reuse of components, and embedded JS code help win the hearts of developers as well. However, the framework has long been plagued with a reputation for poor performance. Is there a way to get more out of a JSF-based app without sacrificing what makes this framework great?
We asked Ted Goddard, Chief Software Architect at ICEsoft Technologies, to offer his best tips for performance tuning to make JSF more mobile friendly. “Once you’ve built your application and it has the feature set that you want, you may need to optimize it to handle the load you’re faced with. Because JSF is providing a lot of rich features, you want to reduce the load you are putting on the server through any unnecessary work.”
Here are a few ways to do just that:
- Take a complex expression language and move that into the bean.
- If part of the page is not visible, move that into a facelet rather than having it be rendered but hidden. In general, trim any unused components (including composites) from the component tree.
- Build pages that represent the small screen size on mobile devices. Design each page to have only what can actually show up and fit on the screen. Performance will be good in that piece because there will be less work for JSF to do to create each pages and less to process for each user interaction.
Design smart for better speed
The goal with JSF for mobile is to create a rich user experience that fits how people use their devices—not necessarily to mimic the same experience they would expect on a desktop. If a process is not adding value in a handheld device, you shouldn’t be asking your JSF to carry that load. Sometimes, performing well is simply a matter of shedding some excess weight.
How do you optimize your JSF based mobile applications? Let us know.