Action components are always stateful, in fact I should have named Action "StatefulAction" and Direct "DirectAction".
So, the action service expects there to be a HttpSession and fails, with StaleSessionException, if there isn't one (it assumes that the user let the session time out, then clicked a link ... or bookmarked a link and clicked it later). -- [EMAIL PROTECTED] http://tapestry.sf.net > Phil, > > Here's some code which does what (I think) you want. > > Please tell me if it doesn't... > > Tom > > Howard, > > There is one thing which puzzled me while I was writing it -- why did I > need to create a session (by creating a persistent page property) before > the Action component would work? > > TestPage.java > ------------------------------------------------------------------ > import com.primix.tapestry.BasePage; > import com.primix.tapestry.IEngine; > import com.primix.tapestry.IRequestCycle; > import com.primix.tapestry.IResponseWriter; > > public class TestPage extends BasePage > { > public static class Thing > { > public Thing(String name) > { > this.name = name; > state = false; > } > > private String name; > private boolean state; > > public void setName(String name) > { > this.name = name; > } > > public void setState(boolean state) > { > this.state = state; > } > > public boolean getState() > { > return state; > } > > public String getName() > { > return name; > } > } > > static Thing[] s_database = new Thing[] {new Thing("Thing One"), new > Thing("Thing Two"), new Thing("Thing Three")}; > private Thing thing; > private Thing[] database; > > public void setThing(Thing thing) > { > this.thing = thing; > } > > public Thing getThing() > { > return thing; > } > > public Thing[] getThings() > { > return database; > } > > public void setThings(Thing[] things) > { > database = things; > } > > public void toggle(IRequestCycle cycle) > { > getThing().setState(!getThing().getState()); > // update database here > } > > public void beginResponse(IResponseWriter writer, IRequestCycle cycle) > { > // read database here > database = s_database; > fireObservedChange("things", database); > } > } > > TestPage.jwc > --------------------------------------------------------------- > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE specification PUBLIC > "-//Howard Ship//Tapestry Specification 1.1//EN" > "http://tapestry.sf.net/dtd/Tapestry_1_1.dtd"> > > <specification class="TestPage"> > <component id="for" type="Foreach"> > <binding name="source" property-path="page.things"/> > <binding name="value" property-path="page.thing"/> > </component> > <component id="name" type="Insert"> > <binding name="value" property-path="thing.name"/> > </component> > <component id="state" type="Insert"> > <binding name="value" property-path="thing.state"/> > </component> > <component id="toggle" type="Action"> > <binding name="listener" property-path="listeners.toggle"/> > <static-binding name="stateful">Boolean.FALSE</static-binding> > </component> > </specification> > > TestPage.html > -------------------------------------------------------------------- > <span jwcid="for"> > <a href="#" jwcid="toggle"><span jwcid="name">Item > Name</span></a>�<span jwcid="state"/><br> > </span> > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] > _______________________________________________ > Tapestry-developer mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/tapestry-developer _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ Tapestry-developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/tapestry-developer
