[
https://jira.jboss.org/jira/browse/JBSEAM-2469?page=com.atlassian.jira.pl...
]
Dan Allen resolved JBSEAM-2469.
-------------------------------
Fix Version/s: 2.0.3.CR2
Resolution: Done
Labels: page-action postback (was: )
I decided to keep the implementation simple by giving the developer a flag to disable the
page action during a standard JSF postback. The spirit of page actions from day 1 was to
provide a way to execute an action on an initial GET request. Typically, you don't
need this behavior during a postback because you have at least a dozen other ways to
perform work (and lots of information to do it with).
To maintain backwards compatibility (and generally just be polite), page actions will
execute on any request by default. If you want to disable the action during a JSF
postback, you would define the action as follows:
<execute action="#{componentName.prepareData}"
on-postback="false"/>
For those of you that requested more features, I want to remind you that the
"if" attribute gives you tremendous flexibility. And you can set any context
variable you want during a page action which you can then reference to disable it on a
subsequent request if the basic use case here doesn't fit your needs. We cannot design
the framework to fill individual needs or else it would become a tangled ball of mess.
add postback flag to page actions
---------------------------------
Key: JBSEAM-2469
URL:
https://jira.jboss.org/jira/browse/JBSEAM-2469
Project: Seam
Issue Type: Feature Request
Components: Core
Affects Versions: 2.0.1.CR1
Reporter: Dan Allen
Assignee: Dan Allen
Fix For: 2.0.3.CR2, 2.1.0.CR1
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:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira