[
http://jira.jboss.com/jira/browse/JBSEAM-2469?page=comments#action_12414252 ]
Dan Allen commented on JBSEAM-2469:
-----------------------------------
Ah, I need to clarify a bit because I see that if I am getting my facts mixed up.
#1) If your navigation rule uses <render> and that view ID is different than the
current view ID, then a new UI component tree is created. That clears any prior page
context variables. However, page actions are *not* executed in this case (because it is
not a top-level request). Page actions are only executed on a new request (regardless of
it being a GET or POST).
#2) If your navigation rule uses <redirect>, regardless of whether the view ID is
the same or different, a new request is issued. As a result, a new UI component tree is
created, any prior page context variables are cleared out, and page actions *do* execute.
Unfortunately, there is no way to know (short of using request parameters) that this
request (after the redirect) has any relation to a postback. (Ah, except the temporary
conversation, which does survive the redirect. So perhaps you could stuff something into
the conversation scope).
So if you are always using <redirect>, then yes, your page actions are going to be
invoked even if you have the postback disabled flag (which is not yet developed). I'm
not sure you are going to get support from Seam here. You need to make your page actions
aware of this situation. My suggestion is to outject something to the conversation scope
and then check for it in your page action. Conversations (even if they are temporary) do
survive the redirect.
You can check for a temporary conversation by using
#{manager.currentConversationEntry.removeAfterRedirect}
add postback flag to page actions
---------------------------------
Key: JBSEAM-2469
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2469
Project: Seam
Issue Type: Feature Request
Components: Core
Affects Versions: 2.0.1.CR1
Reporter: Dan Allen
Assigned To: Dan Allen
Fix For: 2.1.0.BETA2
Original Estimate: 1 hour
Remaining Estimate: 1 hour
Page actions are incredibly useful, but sometimes they can get in the way during a
postback. I would like to see a postback attribute added to the <action> tag that
can be used to disable the action on postback. It's possible using a conditional, but
it is ugly and a lot of typing.
Here is the logic that would go into Pages.java
private boolean isPostBack(FacesContext facesContext)
{
return facesContext.getExternalContext().getRequestParameterMap().
containsKey(ResponseStateManager.VIEW_STATE_PARAM);
}
The conditional alternative would be:
<action execute="#{component.action}" if="#{empty
param['javax.faces.ViewState']}"/>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira