[
http://jira.jboss.com/jira/browse/JBSEAM-1299?page=comments#action_12361757 ]
John Chesher commented on JBSEAM-1299:
--------------------------------------
Gavin,
Here is one example s:link in my appl.
<s:link id="pickUser" value="#{usr.userName}  "
action="#{userSearch.selectUser}"/>
This appears on a User Search screen, where the link exists for each user returned by the
search. Clicking on the link will call the selectUser method, to "select" the
user. The outcome of that method will direct the user (via pages.xml) to an update page
for the selected user. That works fine, however, before redirecting to the User Update
page, Seam is executing the method specified in the page action for the User Search
screen, which I feel is inappropriate. I usually use page actions to prepare data or
similar activities before a page is rendered. However, if the user is leaving that page
and going to another, I don't want to execute the page action.
I gather from your comment that if I specify a viewID as the action, then the page action
of the previous page will not be triggered, but if I specify a bean method, the page
action of the previous page will be triggered. Can you explain why you feel it is
appropriate to trigger the page action, even when that page is not the page to which the
user is being redirected? Understanding the "why" may help me make design
decisions ongoing.
Thanks!
s:link - Postback before redirect triggers Page Action of PREVIOUS
page
-------------------------------------------------------------------------
Key: JBSEAM-1299
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1299
Project: JBoss Seam
Issue Type: Bug
Components: Core
Affects Versions: 1.2.0.GA
Environment: Seam 1.2-Patch1
Reporter: John Chesher
Scenario:
Page A contains an <s:link> to go to page B. Page A has a page action defined in
pages.xml. When I click the s:link on Page A, to go to Page B, it invokes the page action
for Page A before redirecting to Page B. If I replace the s:link with an h:commandLink,
it works as I would expect it to, i.e., no page action for Page A.
I have now retested and I have this scenario in multiple instances within my application.
In most cases, I didn't even realize that it was invoking the page action for Page A,
as by luck the method was designed such that it did not throw an exception or cause any
other noticeable problems. However, I finally noticed this behavior when my luck ran out
and I wrote a page action method that threw an exception when called unitentionally in
this situation.
Is this perhaps a bug in s:link or am I not properly understanding and utilizing its
capabilities?
--
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