[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: SubmitListener [auf Viren geprueft]
From:       "Jonathan O'Connor" <Jonathan.O'Connor () xcom ! de>
Date:       2004-09-30 10:37:07
Message-ID: OF43784CF5.66E1A089-ON80256F1F.0039845B-80256F1F.0039B4E3 () xcom ! de
[Download RAW message or body]

--=_alternative 0039B4E080256F1F_=
Content-Type: text/plain; charset="US-ASCII"

Eric,
After getting into lots of trouble with using listeners attached to each 
button, I have changed our forms to have a single form submit. All the 
buttons use selected="ognl:buttonPressed" tag="buttonName" stuff. Then in 
my listener, I do something like:

public void formSubmit(IRequestCycle cycle) {
        if ("button1".equals(getButtonPressed()) handleButton1(cycle);
        else if ("button2".equals(getButtonPressed()) 
handleButton2(cycle);
}

Of course, this is a bit ugly, and the style Police will surely kill me 
for it, but its very safe code. When we have listeners directly attached 
to each button, we had to be very careful not to add or remove rows from a 
ForEach table. The reason: button listeners are executed before rewinding 
has completed. The form listener only runs after rewinding, so its safe to 
change collections then.

Occasionally, we have to break our rule, and actually write a button 
listener. E.g. In a table, each row might have a delete button. In this 
case, the button listener remembers which row was selected, and sets the 
buttonPressed property to "deleteRow", which is then handled in the normal 
way in our form submit.

Hope this helps,
Jonathan O'Connor
XCOM Dublin



Eric Fesler <ericml@audaxis.com> 
30/09/2004 07:42
Please respond to
"Tapestry users" <tapestry-user@jakarta.apache.org>


To
tapestry-user@jakarta.apache.org
cc

Subject
SubmitListener [auf Viren geprueft]






Hi,

I 'm a newbie with Tapestry and I recently came into what seems to be a
classical issue.

I have a page with Submit components and listener for that components.
Depending upon the position of the Submit components (at the beginning
of the form or at the end of the form) I hved a completely different
behavior.

Looking deeper, I found that it was due to the fact that submit listener
are triggered at the time the component is rewind and that explained the
problem.

I looked for some discussions on the subject and I found the following
page on the wiki.
http://tapestry.sourceforge.net/wiki/index.php/Developer%20Issues
This page mentions that "Howard initiated a discussion on how the
listeners could be improved to make their use more natural to
developers." but there isn't any pointer to such a discussion.

Is there any place where I could find discussion to this issue?

I'm looking for a way to be able to trigger different actions (based on
the clicked button or image) *after* the form has been fully rewind.

Any suggestions?

Thanks,

--ERic



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



--=_alternative 0039B4E080256F1F_=--
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic