[
http://jira.jboss.com/jira/browse/JBSEAM-2469?page=comments#action_12414234 ]
Dan Allen commented on JBSEAM-2469:
-----------------------------------
I'm not sure if I can make this explanation make sense, but what you are proposing is
exactly what I have proposed. Here goes.
The very presence of the javax.faces.ViewState param in the request identifies it as a
postback (the UI component tree is restored). There is no need storing a flag in the page
context since we already know it is a postback then for that page. If you disable the page
action on postback, as I am proposing, then it would be impossible for the page action to
execute twice as long as you continue to postback to the same page (perform any sort of
JSF action on the page).
Now, if you were to navigate after a postback, either to the same page (redirect) or
another page, then it ceases to be classified as a postback at that point. Thus, the page
action will once again be executed for whatever page you are navigating to, again the
behavior you desire.
Trust that what you are asking for is what we plan to implement. Now, if you want to
disable the page action even on a followup initial request (let's say as part of the
same conversation), then you have to do using your own business logic combined with the
"if" attribute on the <action> element.
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