This content has been marked as final.
Show 3 replies
-
1. Re: Page params + action doubt.
fmontezuma Jan 5, 2010 9:11 PM (in response to fmontezuma)I read in Seam in Action (page 125) that to ensure that a page action get executed only during an initial request I should use the conditional:
<action execute="#{actionBean.executeOnInitialRequestOnly}" if="#{empty param['javax.faces.ViewState']}"/>
It have a footnote saying that in JSF 1.2, this check is performed by the ResponseStateManager isPostback(FacesContext) method.
I didn't understand what he mean with this.
-
2. Re: Page params + action doubt.
germanescobar Jan 6, 2010 12:16 PM (in response to fmontezuma)You need to define the actionBean.executeOnInitialRequestOnly() method somewhere like this:
@Name("actionBean") public class ActionBean { public boolean executeOnInitialRequestOnly() { ResponseStateManager rtm = FacesContext.getCurrentInstance(). getRenderKit().getResponseStateManager(); return rtm.isPostback(FacesContext.getCurrentInstance()); } }
This way you ensure that your page action method will be called only once when the page is loaded for the first time and not on postback.
Hope it helps!
-
3. Re: Page params + action doubt.
mwohlf Jan 6, 2010 2:19 PM (in response to fmontezuma)not sure if I miss something here, but I wonder why you don't use on-postback="false" like so:
<action execute="#{actionBean.executeSomeMethod}" on-postback="false" />