I've been playing around with breaking down my application into component and one thing has been giving me headache which is how to correctly handle components inside a @For loop.
take for example a simple component that lets you display a person in either short or full detail view. I would have an @DisplayPerson component that takes a Person object as a parameter. There is a property inside the Person object which reflects whether the person should be shown in detailed or not and so I can easily use an @If with condition="ognl:person.showDetail". I then want to have a @DirectLink that calls a listener that will change this property for example: void myListener(Boolean value){ getPerson().setShowDetail(value); } This works great and provides really nice encapsulation since the component itself handles the link to change the state of whether to show the details or not and has to have no additional knowledge of the outside world except the Person it needs to deal with. Enter the @For problem: When using the @DisplayPerson component inside a @For loop I get an error when doing the getPerson() since the listener is involved directly and apart from the iteration. I know several ways around this. For example the @ActionListener would force a sort of rewind and I would get the correct state (of course this is risky and deprecated since the server side state might no longer reflect the state of the page. I can emulate the same behavior in a safer way by wrapping everything in a @Form and using @LinkSubmits in the @DisplayPerson component. My problem with this approach is that it breaks the encapsulation and just seems like it's confusing things since I'm not actually using a form. I'd like some ideas about a better way to do this. It'd be nice to store the state of the @For loop server side in some automatic fashion. Is this possible? If it is then I think it'd be possible to have something like the @ActionLink component that could be made safe rather than deprecated. Anybody have any ideas? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]