Due to some mix-up with where replies were sent, I will reproduce part on an existing conversation:
-----------------------------BEGIN CONVERSATION--------------------------------------- Filip, Please move this to the mailing list. I think you got my personal e-mail by accident. You will have to use the ListEditMap such that you know which object is being updated because the ListEditMap puts the right object into the property assigned to be updated on each loop. Richard -----Original Message----- From: Filip Balas [mailto:[EMAIL PROTECTED] - Hide quoted text - Sent: Tuesday, April 26, 2005 2:39 PM To: Hensley, Richard Subject: Re: Stale ActionLink problem... Let me rephrase my question. In the wiki, they give an example of a "squeezer enabled" property selection model. The property selection model has the 'label' and the 'value'. Now this works great because the label is what is displayed and the value is the squeezer PK. Now my question is how do I do this for a Textfield? To draw a parallel between the Textfield and the propertySelctionModel so that I can illustrate my question: The label in the propertyselectionmodel is like the 'value' binding of the textfield. So where do I put the 'squeezer' value in a Textfield so that when the form is submitted I can find the right object to update? To me it appears my only solution is to use the much more complicated ListEditMap approach outlined in "Tapestry in Action" Filip On 4/26/05, Hensley, Richard <[EMAIL PROTECTED]> wrote: > You don't pass a PK as a parameter, you pass an object. Tapestry will send > the object through the DataSqueezer, which will reduce it to a object > identifier, in our case that was fully qualified class name followed by the > PK. On the way back in, Tapestry will send it through the DataSqueezer once > again, which will take the object identifier and get the object, which is > then passed to your listener. > > The wiki article goes into the general concepts, I don't know how to adapt > it to you ORM. > > Richard > > -----Original Message----- > From: Filip Balas [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 26, 2005 12:33 PM > To: Hensley, Richard > Subject: Re: Stale ActionLink problem... > > New question... > How do I pass the PK as a parameter in a submit > component? > > Filip > > On 4/26/05, Filip Balas <[EMAIL PROTECTED]> wrote: > > Okay, here's another problem now that I've switched > > to direct links: > > > > Since Actionlink stored the state of all variables for > > each run of the for-loop, there was no problem for > > tapestry to automatically update an Objects attribute > > that corresponeded to a textfield. However, with the > > Direct service, non of this information is saved on the > > server anymore. So how do I retrieve the new value > > that was entered into the textfield so that I can update > > the appropriate Object? > > > > Thanks, > > Filip > > > > > > On 4/26/05, Hensley, Richard <[EMAIL PROTECTED]> wrote: > > > Filip, > > > > > > Review the Wiki for the DataSqueezer article. We had this same problem > and > > > use the DataSqueezer to solve the primary key back and forth processing > for > > > us. This allows your application to deal with fully hydrated objects, > and > > > not with database primary keys. > > > > > > http://wiki.apache.org/jakarta-tapestry/DataSqueezer > > > > > > Richard ----------------END OF CONVERSATION------------------------------------------------- On 4/26/05, Filip Balas <[EMAIL PROTECTED]> wrote: > Hmmm... that's unfortunate. I will have to then send > my object Primary Key attribut as a parameter then > re-fetch it when the form comes back. > > Luckily cayenne caches all of my db objects, otherwise > this solution would be a real pain. > > I'll give it a shot and see how it goes. > > Cheers, > Filip > > > On 4/26/05, Patrick Casey <[EMAIL PROTECTED]> wrote: > > > > .net solved a similar problem with stale action links by encoding every bit > > of data in the outgoing form in a hidden field (serialized into a pretty > > compressed size), so they could always safely "rewind" the form when it came > > back (they use a different term if I recall). They basically rewind by > > deserializing their hidden "state" field, rather than by rewinding from > > session attributes, which lets them come closer to true statelessness. > > > > Dunno if it'd be practical here, but it's definitely an alternate > > approach. > > > > --- Pat > > > > -----Original Message----- > > From: Jamie [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, April 26, 2005 9:27 AM > > To: Tapestry users > > Subject: Re: Stale ActionLink problem... > > > > Here's what Howard had to say about it a while back: > > > > "To be honest, I don't use ActionLink. It predates DirectLink and I > > thought it would be the *way* ... but because of all the issues > > concerning de-synchronized client and server state, it doesn't work for > > me in practice. I've discussed removing it entirely, but some folks > > still like it for initial prototyping, even though they remove it from a > > production application." > > > > Jamie > > > > Filip Balas wrote: > > > Thanks for the feedback. > > > > > > Jamie: > > > ActionLinks are deprecated? > > > That would be aweful!! The beauty of actionlinks > > > is I don't have to serialize my objects and send > > > them as part of the page. Another problem is that > > > all of my objects are connected to a database via > > > cayenne, I'm not sure how serialization affects > > > all of that. Also, in another app my objects are > > > rather large so serializing them into directlinks > > > would make my webpage very large. I sincerely > > > hope you are mistaken about this. > > > > > > mb: > > > The T-Deli 'For' component should be taking care > > > of the fact that my form is connected to a list of > > > database objects. Here is some of the code I'm > > > using: > > > > > > PAGE FILE: > > > > > > <property-specification name="newTitleString" type="java.lang.String"/> > > > <property-specification name="titleDept" > > > type="com.imvprojects.phoneList.data.Title_OR_Dept"/> > > > > > > <component id="newTitle" type="TextField"> > > > <binding name="value" expression="newTitleString"/> > > > </component> > > > > > > <component id="createNewTitleButton" type="Submit"> > > > <binding name="listener" expression="listeners.createNewTitleDept"/> > > > </component> > > > > > > <component id="titlesList" type="base:For"> > > > <binding name="source" expression="getTitleDeptList()"/> > > > <binding name="value" expression="titleDept"/> > > > </component> > > > > > > <component id="title_or_dept" type="TextField"> > > > <binding name="value" expression="titleDept._description"/> > > > </component> > > > > > > <component id="saveChanges" type="ActionLink"> > > > <binding name="listener" expression="listeners.saveTitleDept"/> > > > </component> > > > > > > JAVA: > > > public abstract class ManageTitles extends AuthenticatedPage { > > > public abstract String getNewTitleString(); > > > public abstract void setNewTitleString(String title); > > > > > > public abstract Title_OR_Dept getTitleDept(); > > > public abstract void setTitleDept(Title_OR_Dept td); > > > > > > public List getTitleDeptList() > > > { > > > List allTitles = > > > Title_OR_Dept.get_all_titles_and_departments(getVisitDataContext()); > > > Collections.sort(allTitles); > > > return allTitles; > > > } > > > > > > public void createNewTitleDept(IRequestCycle cycle) > > > { > > > Title_OR_Dept newTitleDept = > > Title_OR_Dept.create(getVisitDataContext()); > > > newTitleDept.set_description(getNewTitleString()); > > > getVisitDataContext().commitChanges(); > > > } > > > > > > public void saveTitleDept(IRequestCycle cycle) > > > { > > > getVisitDataContext().commitChanges(); > > > } > > > } > > > > > > Here's what happens: > > > The page render fine initially. > > > > > > I can add as many Titles/Departments as I like and the page > > > will render just fine with the 'new title/department' creation part > > > at the top followed by a list of existing 'titles/deparments' that > > > are in editable text fields followed by a 'save' link. > > > > > > However, click any of the 'save' links, I recieve the exception. > > > > > > Thanks for your help, > > > Filip > > > > > > > > > > > > On 4/26/05, Mind Bridge <[EMAIL PROTECTED]> wrote: > > > > > >>Hi, > > >> > > >>Just a suggestion given that there is no code mentioned: > > >> > > >>This exception usually means that the form is slightly different than > > >>what was rendered originally. Do you happen to be using a Conditional > > >>component somewhere in the form? Could you use the 'If" one instead? > > >> > > >>-mb > > >> > > >> > > >>Filip Balas wrote: > > >> > > >> > > >>>I am using the T-Deli 'For' component to > > >>>dynamically create a list of editable items. > > >>>Now the form renders fine, I can add items > > >>>to it but when I try and click on any of the > > >>>actionlinks which I generated to remove or > > >>>save changes to the item in question, I recieve > > >>>the following error: > > >>> > > >>>You have clicked on a stale link. > > >>>Action id 1 does not match component ManageTitles/deleteTitle. > > >>>This is most likely the result of using your browser's back button, > > >>>but can also be an application error. > > >>>You may continue by returning to the application's home page > > >>></phonelist/app?service=home>. > > >>> > > >>> > > >>>Now I've looked at TiA, googled the net and tried > > >>>to find something on the mailing list but other people > > >>>are having a different problem than mine. I am not having > > >>>problems with the form not rendering due to inconsistencies > > >>>between the number of form elements between requests > > >>>(this is the problem everyone is talking about). My problem > > >>>seems to be that Tapestry is having trouble figuring out > > >>>which link belongs to which listener... > > >>> > > >>>Does anyone know where I could start looking for a solution > > >>>to this? > > >>> > > >>>Filip > > >>> > > >>>--------------------------------------------------------------------- > > >>>To unsubscribe, e-mail: [EMAIL PROTECTED] > > >>>For additional commands, e-mail: [EMAIL PROTECTED] > > >>> > > >>> > > >>> > > >>> > > >>> > > >> > > >>-- > > >>No virus found in this outgoing message. > > >>Checked by AVG Anti-Virus. > > >>Version: 7.0.308 / Virus Database: 266.10.3 - Release Date: 4/25/2005 > > >> > > >> > > >>--------------------------------------------------------------------- > > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > > >>For additional commands, e-mail: [EMAIL PROTECTED] > > >> > > >> > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
