File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Performance of a JSF page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Performance of a JSF page" Watch "Performance of a JSF page" New topic

Performance of a JSF page

Padma Priya
Ranch Hand

Joined: Feb 01, 2007
Posts: 116

I have a jsf page which has several tabs and we make use of IBM tags. The current IBM code sends all the tabs across, even if they are never accessed. The jsp pages that are included in the subviews inturn access backend procedure where the business logic of the screen resides. This is making the screen to load very slowly and becoming a pain.

Is there any way i can load the subview only upon clicking that tab.

Can anybody advice if there is any other way that i can improve the performance of the screen.

Thank you!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

The first thing that comes to mind is AJAX. If you defer loading the tab contents until you actually need them, you can speed things up because you don't load what you don't need. Of course the penalty is that the first display of the tab will be delayed while it loads.

You say you're using "IBM" tags, but these are standard JSF core elements you're using here, except for the "jsp:" elements, which are JSTL (and probably shouldn't have been used - use the Facelets ui:include instead).

To get the tab contents to load via AJAX would require one of the following:

1. Manual AJAX javascript coding (JSF 1.1, JSF 1.2)

2. The AJAX support tags in JSF 2

3. An AJAX-friendly tab control such as the one that comes with JBoss RichFaces.

Of the 3, I do recommend that you use an extension tagset that actually supports tabs (option 3), if it's permitted. It's a lot easier to code and maintain.

An IDE is no substitute for an Intelligent Developer.
Padma Priya
Ranch Hand

Joined: Feb 01, 2007
Posts: 116
Hi Tim,

The option 1 given by you seems to be a feasible solution for me.

But i am not sure how to code ajax.

The tabs are coded as shown above. We are making use of IBM tabs.

The attempt is to have Tab contents rendered as Ajax enabled.
1) Initially,When the screenloads,Tab1 will only be retrieving Data to be rendered.
2) When the user clicks on Tab2, then "on click" of Tab2, the data for Tab2 should be loaded.
3)If i click Tab1 again, it should refresh only Tab1.

Also going through several forums online they suggested that since bfPanel tags don't support behaviors, so we have to Add a hidden button that can be clicked to the page for each ajax call that we make. That makes sense but i am not sure how to code it as i am new in JSF. Can you give me a code snippet that i can follow

Thank you!
I agree. Here's the link:
subject: Performance of a JSF page
jQuery in Action, 3rd edition