The @Persist("flash") removes the object after page B is processed the first
time, then when you call the action handler page B is processed again and
your field is null, as it should be.

You should be able to simply add a cleanupRender method to page B which
resets the flash persisted field. I believe that when the action event is
triggered by the img it will get access the persisted field which nulls the
field, and won't trigger the cleanupRender thus allowing the field to stay
null.

I haven't written the code, but I'm fairly sure that it should work and it's
not much work to test it out.

Good luck,
Josh


On 10/26/07, ronaldlee <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I am having problem with @Persist(Flash) and StreamResponse.. I am using
> the
> latest 5.0.6 release.
> Here is my setup:
> - I have two pages, page A is for uploading an image, and page B is for
> previewing an image.
> - Page A injects Page B, and Page B has a @Persist("flash") on a
> "imageFilename" attribute.
> - Page A's onSuccess method is called when an image file is uploaded
> (using
> tapestry-upload), then it will call Page B's setImageFilename method to
> pass
> on the filename being uploaded, then Page B is returned.
> - Page B will use the StreamResponse approach to return the image file
> (because the image file is stored in a location not directly accessible
> from
> Internet), following the tapestry howto's instruction
> (http://wiki.apache.org/tapestry/Tapestry5HowToCreatePieChartsInAPage).
> Page
> B injects a ComponentResource for creating an action link, which in return
> will be inserted in the template.. see the howto's for more detail.
>
> And here is the problem, inside that "StreamResponse onImageFileURL()"
> function, the "imageFilename" attribute is null (and as a result I cannot
> read that file of course), but on Page B's template I am able to display
> the
> value ${imageFilename}. There may have something to do which come first
> (the
> onImageFileURL is called first before the imageFilename is set?).
>
> Is it an issue and is there any workaround? Or just I am doing it the
> wrong
> way?
>
> thx!
> Ronald
>
> --
> View this message in context:
> http://www.nabble.com/T-5--%40Persist%28%22Flash%22%29-and-StreamResponse-tf4700054.html#a13436353
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Reply via email to