Hi, I think there'll be a way to solve this in Tapestry 4.0.

Meanwhile, I wrote a component that solves this problem. It's called
SafeForeach. It caches the list you pass on to it so it will rewind
correctly even if you make changes to the list on a listener method. Just
now uploaded it to Tassel.

http://equalitylearning.org/Tassel/app?service=direct/1/Browse/viewComponent
&sp=SdsouzaSafeForeach


Cheers!
Denis

-----Original Message-----
From: Marc A. Donis [mailto:[EMAIL PROTECTED] 
Sent: sexta-feira, 17 de junho de 2005 17:05
To: [email protected]
Subject: stale link? (newbie)

sorry if this is a double post...  not sure the first one went.

Hi.  I'm new to Tapestry... trying hard to make a transition from WebObjects
:)

Here's my problem:

I have a List of Strings through which I iterate, displaying one checkbox
for each item in the List.  In the form's submit action method, I add an
item to the List.  This is what happens after the first submit:

You have clicked on a stale link.
Rewind of form Home/$Form expected only 1 form elements, but an additional 
id was requested by component Home/$Checkbox.

I suppose that the "1 form element" mentioned is the form's submit button.
Any hints/clues/suggestions?  What am I doing wrong here?

Thanks!


The code:

public class Home extends BasePage {
    private List<String> someList = new LinkedList<String>();
    public String listElement;

    public void formSubmit(IRequestCycle cycle) {
        someList.add("hooohaw");
    }

    public boolean isCheckboxSelected() {
        return true;
    }

    public void setCheckboxSelected(boolean val) {
    }

    public Iterator<String> getSomeList() {
        // someList.add("hooohaw");  // putting this here instead of in 
formSubmit results in the same error
        return someList.iterator();
    }
}


The HTML:

<html>
    <body>
        <form jwcid="@Form">
            <input type="submit" jwcid="@Submit" value="Submit"
listener="ognl:listeners.formSubmit"/>
            <span jwcid="@Foreach" source="ognl:someList"
value="ognl:listElement" >
                <input type="checkbox" jwcid="@Checkbox"
selected="ognl:checkboxSelected"/>
            </span>
            <br/>
        </form>
    </body>
</html>

The environment:
JDK 1.5.0_02
Tapestry 3.0.3
Windows XP
Tomcat 5.5




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

Reply via email to