Hi,

I want to be able to hand objects from the listener that gets called as a result of a form submit or DirectLink to the page that is called next.

In the VLib example, this is done like this (in this case the return value of updatedBook() would be the object that gets passed):

   public IPage formSubmit(IRequestCycle cycle) {
      /* actual work done here */
       MyLibrary page = (MyLibrary) cycle.getPage("MyLibrary");
       page.setMessage(updatedBook(attributes.get("title")));
       return page;
   }


This is how I have done it so far as well.
However: when returning an IPage object, you are vulnerable to Browser-Refresh problems: Assume your form is supposed to create a new object and add it into the database. At the end you use setMessage() to stick the "Object added successfully" message into the new result page and return the page. The user will get to the next page and see "Object added successfully". So far so good. Now the user clicks the "Refresh" button on his browser. The request gets executed again, the object is created a second time, and you now have a duplicate copy in the DB. This should not happen.

In order to avoid this, I switched from returning a page object to returning an ILink object with a link to the "MyLibrary" page. But now I can not call setMessage any more. When the new page comes up as a result of the ILink, there will not be a Message. So would I now have to stick the message into the session? Or the visit object? Use an ASO?

I thought about using an ASO, but here is the problem: Instead of one String, I use an entire list, that can have as many Strings as the List collects in the course of the request processing. The hibernate doc says (C:\Program Files\Java\docs\tapestry\4.0\UsersGuide\state.html): "If the values stored as a persistent property is /mutable/ (for example, a List, or a Map, or some custom Java class), you should /not/ modify its internal state once it has been stored into the persistent page property. Changes to internal state of a persistent property, after it has been stored, may /not/ be propogated to other servers in the cluster"

This sounds to me like adding my MessageList as an ASO will not work in cluster environment, because Messages that are collected and added to the list during the request may not be propagated to all nodes of the cluster. So if the returned ILink gets processed by a different cluster node than the node that put the messages in the List, the List might be empty (or at least missing some of the messages). Unless I can fill the list first and then store it as an ASO after all the messages have been added, just before I return the ILink object. But I don't know how to do that...

Any pointers here?

Thanks,

MARK



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to