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

JSF 1.2 Postback

jmiller jmiller

Joined: May 14, 2009
Posts: 2

I've tried to solve this problem many ways, I just can't seem to find a good way around this. Thanks for any advice.

I'm using Richfaces, although, this problem also occurs in other frameworks, so I'm assuming its JSF 1.2 specific.
What I'd like to do and what I have is one page say test.jsp, that is the app with Richfaces components. In this
app I have a very large data pagination table that is in a verbatim section draw by calling a Java method. The
table does not use any components. What happens is, the a4j slows down tons, due to trying to render this full
table on all ajax calls, I'm not sure why JSF or the framework calls the method to redraw this part of the page
and holds it in the tree to send through ajax, but I understand using a postback check should prevent this.

So I've tried to use the post back check in 1.2:
public static boolean isPostBack() {
ResponseStateManager rsm = FacesContext.getCurrentInstance().getRenderKit().getResponseStateManager();
return rsm.isPostback(FacesContext.getCurrentInstance());

Inside the method that is getting called, however, FF consistently doesn't draw since this is a postback call when doing
a javascript resubmit onclicking a link in the app that is non-ajax based, although IE will seemingly randomly draw the
table. I'm not sure if this postback check is an issue with JSF or the browsers.

I'm also not sure how to get around this problem, I tried adding in code to fix this, which gets around the problem in FF but
not in IE. Just curious on how to render this table without ajax slowing down keeping the table in the tree for the view.

Thanks, I hope I explained this well, its hard to describe the issue, feel free to ask more questions on my issue etc. I'd
really like to understand the issues here and how to get around this.
jmiller jmiller

Joined: May 14, 2009
Posts: 2
This was solved, turns out there was a couple issues here.

One was the Postback, another was a redraw issue with when to draw
parts of the JSF page due to mixing ajax and non-ajax requests. And
a race condition thats probably more tool specific using the richfaces

The issue with richfaces was that I was doing a javascript page submit,
and richfaces was trying to do a ajax request after the submit, but my
best guess is that a submit event was being fired by javascript and allowing
another function call to take place attempting to do an ajax request by
the component and the behavior on this was of course different between
browsers. IE and Chrome had the issue, and FF didn't seem to have the issue.
I agree. Here's the link:
subject: JSF 1.2 Postback
It's not a secret anymore!