Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for change notification.
The following page has been changed by superoverdrive: http://wiki.apache.org/tapestry/Tapestry5AvoidingDifferentObjectWithSameIDExceptions The comment on the change is: ------------------------------------------------------------------------------ First of all, a simple example that shows this error can occur (Tapestry 5.0.17): + Imagine the following: + + 1. A page that shows objects to be edited inside of a Grid (EditDomains) + An "Edit Link" inside of the grid table that will link to another page that allows editing of the object. + The "Edit Link" passes the whole object to the Edit Page. + + 2. The Edit Page receives the edited object and saves it. + + EditDomains.tml + + {{{!#HTML + + <t:grid source="domains" row="domain" model="domainsGridModel"> + + <t:parameter name="editcell"> + <t:actionlink t:id="edit" context="domain">Edit</t:actionlink> + </t:parameter> + + </t:grid> + + }}} + + EditDomains.java + + {{{!#JAVA + + @InjectPage + private EditDomain editDomain; + + EditDomain onActionFromEdit(Domain domain) + { + editDomain.setDomain(domain); + return editDomain; + } + + + }}} + + + EditDomain.tml + + {{{!#HTML + + <table class="datainput"> + <form t:type="Form"> + <tbody> + <tr><td class="key">Name</td><td class="name"><t:textfield value="domain.name"/></td></tr> + <tr><td class="key">Inherit from</td><td class="name"><t:select model="domainsSelectModel" encoder="domainsSelectModel" value="domain.parent"/></td></tr> + <tr><td class="key">URL</td><td class="name"><t:textfield value="domain.url"/></td></tr> + <tr><td></td><td><t:submit t:id="addDomain"/></td></tr> + </tbody> + </form> + </table> + + }}} + + EditDomain.java + + {{{!#JAVA + + private void onSelectedFromAddDomain() { + + + session.updateOrUpdate(domain); + + }}} + --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
