Error Rendering Viewcustomer.xhtml] The class 'java.lang.String' does not have the property 'desc'.

tra properties that are used to figure out which row was being referenced.

Backing a dataTable directly with a collection in JSF1 would result in a runtime data type error.

Also, periodically people want to use a hashmap as a collection object for a JSF dataTable. This doesn't work, since the model for dataTable must have a discrete linear ordering in order to produce predictable results and a HashMap is a random-access collection with no inherent ordering. So to assure the necessary row ordering you need to provide some sort of adapter that enforces order on values returned from the HashMap. This can either be done by sorting the items into a List object or using a Map class that supports ordered retrieval such as a TreeMap.

Oh, and by the way. You don't write Controllers in JSF. The Controllers are pre-written and supplied with JSF itself. Backing beans are Models.

as I said, a JSF backing bean isn't a Controller, it's a Model. And View Definitions shouldn't "pass parameters", because they are intended to be templates, not logic repositories.

You can do what you want to do just by manipulating the Mode, but, as mentioned previously, you do need a sub-model (DataModel) to act as an intermediary between your raw data and the View Component (dataTable). Otherwise you'd have to code JSF-specific properties into the collection itself, which defeats JSF's POJO-oriented philosophy.

Back  [1] [2] [3] [4] [5] [6] 

Copyright © 2007-2012 www.chuibin.com Chuibin Copyright