A common way to solve this is to use a listener on the @Form component, which is defined to be called when the rewind is complete. Inorder to figure out which @Submit button was pressed use the selected and tag properties.
This makes the position of the submit button less important.
Richard
This is what works for me: I extend my pages from my OnSubmitDelegatorPage
public class OnSubmitDelegatorPage extends BasePage{private String onSubmitMethod;
public String getOnSubmitMethod(){
return onSubmitMethod;
} public void setOnSubmitMethod( String onSubmitMethod ){
this.onSubmitMethod = onSubmitMethod;
}public void onSubmit( IRequestCycle cycle ) throws Exception{
if( getOnSubmitMethod() != null ){
Method m = this.getClass().getMethod( getOnSubmitMethod(), new Class[]{IRequestCycle.class} );
if( m != null ){
m.invoke( this, new Object[]{cycle} );
}
}
setOnSubmitMethod( null );
}
}
Then in the html submit button looks like this:
<form action="" jwcid="crudForm">
<input type="submit" value="Delete" class="button" jwcid="@Submit" tag="deleteUser" selected="ognl:onSubmitMethod" />
................
This causes method deleteUser being executed by formSubmit listener after the rewind completes
And page spec says:
<page-specification class="com.kgionline.demo.tapestry.tag.pages.UserCRUDPage" >
<property-specification name="onSubmitMethod" type="java.lang.String"/> <component id="crudForm" type="Form"> <binding name="listener" expression="listeners.onSubmit"/> </component>
</page-specification>
Full source code is here: http://kgionline.com/presentations/tapestry/tapestry_tag_demo.zip
-- Thanks,
Konstantin Ignatyev
http://www.kgionline.com
PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2.700 tons of CFCs to the stratosphere, and increase their population by 263.000
Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools. New York: State University of New York Press, 1997: (4) (5) (p.206)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
