Hi,
I'd like to implement a form to edit elements of a collection. The contained
list is fetched onActivate of the submit request as well, so the loop is
marked as volatile.
The critical part, I'm not able to get to work, is where I add a new Element
(virtually on client side) to the list.
I do not want to add the colletion to the session because this is imho not
where it belongs. It is much more to be passed from request to request. Just
for the redirect after the post it should be passed through the flash scope.
The adding of the new element is triggered by a button in the form (which
has to be submitted fully as well to not loose any info that has been
entered in paralllel). After the next Submit the collection is refeched
from db (because volatile) and tapestry tries to update the collection with
the content of the request, but since the collection in the request contains
more elements than the one that got loaded, it throws a
NoSuchElementException.
How do I fix this without throwing the collection into the session ?
The template:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
Element:
input:
--
The page class:
public class CollectionTest {
@Inject
private Facade _facade;
@Inject
private ComponentResources _resources;
@Persist("flash")
private List _collection;
private Element iter;
public void onActivate() {
if ( _collection == null ) {
collection = _facade.getCollection(..);
}
}
public void cleanupRender() {
_resources.discardPersistentFieldChanges();
}
public void onSelectedFromAddElement() {
_collection.add(new Element());
}
public void onSelectedFromSave() {
//_facade.store(_collection, ..);
}
public List getCollection() {
return _collection;
}
public void setCollection(List collection) {
_collection = collection;
}
public Element getIter() {
return iter;
}
public void setIter(Element iter) {
this.iter = iter;
}
}
--
View this message in context:
http://www.nabble.com/T5%3A-Dynamically-extending-volatile-list-tp17666544p17666544.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]