so the workflow looks like:

some action ( submit? ) on page 1
  -> generate and set data on page 2
  -> display page 2 (data is ok)
  -> submit form (page 2)
  -> page 2 displayed, data is lost

Briefly looking at the code it seems you just have to add a hidden with the value binding ognl:someData inside your form.

Cheers,
Ron Piterman







Ted Steen wrote:
Hi!

I'm trying to edit a set of values, and it works fine if I use
@Persist on the data I'm trying to edit.
I would like to avoid @Persist as much as I can as it bloats the session.
Therefore I would like some guidance on how to do it without @Persist
I would like to point out that I have tried @Persist("client"), it
didn't work, the values where reverted the second submit, try it
yourselves.
Another thing I considered was using the @Hidden component, but it
behaved like the @Persist("client") (reverted the values on the second
submit)

Please help!

This is what I've got:

/*****************************Home.java****************************************************/

public abstract class Home extends BasePage {

        @InjectPage("AnotherPage")
        public abstract AnotherPage getAnotherPage();
        
        @Bean
        public abstract SomeData getSomeData();
        public abstract int getSize();
        
        public IPage doSubmit() {
                SomeData data = getSomeData();
                data.setValues(new TreeSet<ValuePair>());
                for(int i = 0; i < getSize(); i++) {
                        data.getValues().add(new ValuePair(i + ": ", "" +
(int)(Math.random()*100)));
                }

                AnotherPage p = getAnotherPage();
                p.setSomeData(data);
                return p;
        }
}


/*****************************Home.html****************************************************/

<html jwcid="@Shell" title="Tapestry Sandbox">
        <body jwcid="@Body" >
                <form jwcid="[EMAIL PROTECTED]">
                        <label for="someData">name</label><input jwcid="[EMAIL 
PROTECTED]"
value="ognl:someData.name" /><br />
                        <label for="size">size</label><input jwcid="[EMAIL 
PROTECTED]"
value="ognl:size" translator="translator:number"
validators="validators:required" />
                        <input jwcid="[EMAIL PROTECTED]" value="literal:submit"
listener="listener:doSubmit" />
                </form>
        </body>
</html>

/*****************************AnotherPage.java****************************************************/

public abstract class AnotherPage extends BasePage {
        public abstract ValuePair getCurrValue();

        @Persist
        public abstract void setSomeData(SomeData data);
        public abstract SomeData getSomeData();
        
        public void doSubmitResult() {
                System.out.println("name: " + getSomeData().getName());
                for(ValuePair currValue : getSomeData().getValues()) {
                        System.out.println(currValue.getName() + ": " + 
currValue.getValue());
                }
        }
}

/*****************************AnotherPage.html****************************************************/

<html jwcid="@Shell" title="Tapestry Sandbox - Another Page">
        <body jwcid="@Body" >
                <b><span jwcid="@Insert" value="ognl:someData.name" /></b>
                <form jwcid="[EMAIL PROTECTED]">
                        <span jwcid="[EMAIL PROTECTED]" 
source="ognl:someData.values"
value="ognl:currValue">
                                <span jwcid="@Insert" value="ognl:currValue.name" 
/><span
jwcid="[EMAIL PROTECTED]" value="ognl:currValue.value" /><br />
                        </span>
                        <input jwcid="[EMAIL PROTECTED]" value="literal:submit 
result"
listener="listener:doSubmitResult" />
                </form>
                <a jwcid="[EMAIL PROTECTED]" value="literal:restart" 
page="Home">home</a>
        </body>
</html>

/******************************************************************************************************/

Thanks for taking your time,
/ted

---------------------------------------------------------------------
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]

Reply via email to