*
The moose likes JSF and the fly likes SOLVED: prevent a page from redrawing in JSF/RichFaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "SOLVED: prevent a page from redrawing in JSF/RichFaces" Watch "SOLVED: prevent a page from redrawing in JSF/RichFaces" New topic
Author

SOLVED: prevent a page from redrawing in JSF/RichFaces

kirk israel
Greenhorn

Joined: May 28, 2009
Posts: 27
I'm still not 100% on JSF/RichFaces and I'm having to debug someone else's code...

They have a "Jurisdiction Finder" that works pretty well. It lives in a rich faces modalPanel -- the modalPanel has a form that conducts some searching, and then on "OK", the window closes, and passes its value to the form on the main page section.

The trouble is it's causing the entire page to reload, clearing out anything on the page.

the ok/cancel button are as follows
<h:panelGroup style="text-align:center;">
<h:commandButton id="okBtn" value="Ok"
disabled="#{!handler.popupHandler.validSearchJurisdictionResult}"
actionListener="#{handler.updateJurisdictionListener}"
oncomplete="Richfaces.hideModalPanel('#{popupName}'); return false;"
reRender="#{reRender}">
</h:commandButton>
<rich:spacer width="20px" />
<h:commandButton immediate="true" value="Cancel"
onclick="Richfaces.hideModalPanel('#{popupName}'); return false;" />
</h:panelGroup>
the same form inside the popup is used to search itself, w/o submitting the whole page

One Weird thing is I can add a 3rd button:
<h:commandButton value="not Ok!!!" />
and it will hide the panel and reset the page... well I guess not really, I guess it's just resetting the page!

So how can I find out what's causing the whole page to be reloaded when this form is submitted? It seems to be set up to "know" what it needs to reRender..


the surrounding jurisdiction_searc.xhtml is included thus:
<ui:include src="/WEB-INF/view/components/jurisdiction_search.xhtml">
<ui:param name="handler" value="#{locationMatrixBean.filterHandler}"/>
<ui:param name="popupName" value="searchJurisdiction"/>
<ui:param name="popupForm" value="searchJurisdictionForm"/>
<ui:param name="reRender" value="locationMatrixForm:jurisInput"/>
</ui:include>

I realize this might not be enough information, but I'm just not sure how much to include...

Thanks for any suggestions!

kirk israel
Greenhorn

Joined: May 28, 2009
Posts: 27
AARGH - whoever wrote this put in an h:commandButton, not an a4j:commandButton. That one little change fixed the whole thing!

Rohit Boorugu
Greenhorn

Joined: Oct 06, 2009
Posts: 14
use ajaxsingle="true" so that the whole page is not refreshed.
 
jQuery in Action, 2nd edition
 
subject: SOLVED: prevent a page from redrawing in JSF/RichFaces
 
Similar Threads
facelets modalPanel template question
h:commandButton and h:commandLink not invoking the model during first click
Backing Bean Behaviour on MyFaces using A4J
h: panelGroup issue
Simple loop/function in XHTML page