The file is successfuly deleted, but the problem is when reloading the page (Manually).
In my listener I redirected: throw new PageRedirectException(cycle.getPage("Images")); where Images is my current page. In this case, no error is displayed, but when reloading, the next image in list is also deleted. I found a way to prevent this, but I don't think is a very good way: I substitute StaleLink.page and StaleLink.html. At the StateLink.html I wrote: <script type="text/javascript">window.location.href=document.referrer;</script> It works, but only if I use externalLinks. But when I submit a new image, it clears my external refference. So I don't think this is a solution. I read at the Reference, about "Form" Component: Parameter: stateful If true (the default), then the component requires an active (i.e., non-new) HttpSession when triggered. Failing that, it throws a StaleLinkException. If false, then no check is necessary. Generally, forms are stateful, but it is possible to put a stateless form onto the Home page of an application. I thought this could help me, but it didn't. I believe there is a simple solution to my problem. Here is some of my code: public void DeleteImg(IRequestCycle cycle){ boolean exists = (new File(uploadPath+getSelectedName())).exists(); if(exists){ boolean success = (new File(uploadPath+getSelectedName())).delete(); if (!success) { // Error Handling } } } At my page: <property-specification name="currImg" type="java.io.File" /> <property-specification name="selectedName" type="java.lang.String" initial-value="''"/> ... <component id="feImage" type="Foreach"> <binding name="source" expression="fileList"/> <binding name="value" expression="currImg" /> <binding name="index" expression="index"/> <static-binding name="element" value="tr"/> </component> <component id="iFileName" type="Insert"> <binding name="value" expression="currImg.name"/> </component> <context-asset name="delete" path="images/error.png"/> <component id="sbDel" type="ImageSubmit"> <binding name="image" expression="assets.delete" /> <binding name="selected" expression="selectedName"/> <binding name="tag" expression="currImg.name"/> <binding name="listener" expression="listeners.DeleteImg"/> </component> Thanks. 2005/5/3, Konstantin Iignatyev <[EMAIL PROTECTED]>: > Try replacing ImageSubmit by DirectLink with a parameter(image name?) > that will allow deletion of chosen image; > > > Alberto Lepe wrote: > > >Here is the challenge: > > > >I have a List of Image's File name, with an ImageSubmit to delete them, like: > > > >image1.jpg [X] > >image2.jpg [X] > > > >Quite simple. I press on the [X] and the image is deleted succesfully. > >If I reload the page, it display a "Stale link" error. This also > >happens if other user is watching the same list and want to delete a > >file that was deleleted seconds ago. > > > >I tried to redirect the page on my listener, but with out success. I > >don't want to override my Engine class. Any other option? > > > >Thank you! > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > -- > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]