Great idea, it was corrected. Thanks.
On Fri, Dec 19, 2008 at 10:17 AM, Joe123 --- <jpe...@hotmail.com> wrote: > > Hi, > > Thanks for your answer. I forgot to add the > public void onPrepare() and therefore the list was empty. > > Thanks. > > One addition for the tapestry wiki page. > > I think it is better to replace: > String accessActualName = transformation.addField(Modifier.PRIVATE, > "org.apache.tapestry5.ioc.services.PropertyAccess", "_access"); > into: > String accessActualName = transformation.addField(Modifier.PRIVATE, > PropertyAccess.class.getName(), "_access"); > > So we use no hardcoded package names. > > > > > Joe, > > > > There were some errors on the wiki page and I've already corrected it, > but > > was nothing related with this problem. > > I can't reproduce it here, can you show some more of your code so I can > test > > it here? > > > > > > > I have been debugging and noticed that the failure is in the > > > GenericValueEncoder.toValue method > > > The idFieldAdapter property is null and therefore it can't find a > match. > > > > > > And why is the idFieldAdapter null? > > > Because in the constructor(see below), the list parameter was null > after > > > submitting the form. > > > Do I need to persist my List of objects? I don't want this.... > > > And I think the example on the wiki doesn't work as well. > > > > > > Does anyone had this error earlier? > > > > > > > > > public GenericValueEncoder(List<T> list, String idField, PropertyAccess > > > access) { > > > if (idField != null && !idField.equalsIgnoreCase("null")) { > > > if (list.size() > 0) { > > > this.idFieldAdapter = > > > access.getAdapter(list.get(0).getClass()).getPropertyAdapter(idField); > > > } > > > } > > > this.list = list; > > > } > > > > > > > Hello > > > > > > > > I use the select component with the @InjectSelectionModel annotation > as > > > described here: > > > > http://wiki.apache.org/tapestry/Tapestry5AnotherSelectWithObjects > > > > > > > > <select t:type="select" t:id="categorySelect" > > > model="categoriesSelectionModel" encoder="categoriesValueEncoder" > > > value="selectedCategory" /> > > > > > > > > The select is nicely loaded with categories. Next I submit the form > and I > > > notice that the setSelectedCategory method is called. But it prints > > > "setSelectedCategory: null" > > > > See below for some the corresponding java code. What am I doing > wrong? > > > Why is the selectedCategory null, after I have selected a category and > > > submitted the form? > > > > > > > > @InjectSelectionModel(labelField = "name", idField = "id") > > > > @Property > > > > private List<Category> categories = new ArrayList<Category>(); > > > > > > > > @Persist > > > > private Category selectedCategory; > > > > > > > > public void setSelectedCategory(Category selectedCategory) { > > > > > > > > System.out.println("setSelectedCategory: " + selectedCategory); > > > > > > > > this.selectedCategory = selectedCategory; > > > > > > > > } > > > > > > > > public Category getSelectedRootCategory() { > > > > return selectedRootCategory; > > > > } > > > > > > > > > > > > > > > > _________________________________________________________________ > > > > More than messages–check out the rest of the Windows Live™. > > > > http://www.microsoft.com/windows/windowslive/ > > > > > > _________________________________________________________________ > > > Show them the way! Add maps and directions to your party invites. > > > http://www.microsoft.com/windows/windowslive/events.aspx > > > > > > > > > > -- > > Atenciosamente, > > > > Marcelo Lotif > > Programador Java e Tapestry > > FIEC - Federação das Indústrias do Estado do Ceará > > (85) 3421-5910 > > _________________________________________________________________ > Drag n' drop—Get easy photo sharing with Windows Live™ Photos. > > http://www.microsoft.com/windows/windowslive/photos.aspx -- Atenciosamente, Marcelo Lotif Programador Java e Tapestry FIEC - Federação das Indústrias do Estado do Ceará (85) 3421-5910