Property 'valeur.desc' not found on type
Bonjour,
J'ai crée une application en JSF 2 qui charge un fichier JSON depuis un emplacement puis renvoi la valeur du nom property dans le fichier JSON. Or la valeur de ce champ possède un . (valeur.desc).
Les données sont chargées dans une ArrayList récupérant un header et une property.
J'ai le message d'erreur suivant :
Code:
javax.servlet.ServletException: /list.xhtml: Property 'valeur.desc' not found on type
Je suis obligé d'utiliser cette syntaxe en . pour la propriété.
Code:
1 2 3 4 5 6 7 8
|
{
"entity" : "poste",
"columns": [{
"header": "uniteTravailList.title",
"property": "uniteTravail.lib"
}]
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
<p:columns value="#{listForm.pivotTable.columns}" var="column"
columnIndexVar="colIndex" sortBy="#{data[column.property]}" filterBy="#{data[column.property]}">
<f:facet name="header">
#{text[column.header]}
</f:facet>
#{data[column.property]}
</p:columns> |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
@ManagedBean("listForm")
@Component("listForm")
@RequestScoped
public class ListForm extends BasePage implements Serializable {
private static final long serialVersionUID = 1L;
private DynamicTable pivotTable = new DynamicTable(this.getEntity());
public ListForm() {
}
public DynamicTable getPivotTable() {
pivotTable.setEntityName(this.getEntity());
return pivotTable;
}
public void setPivotTable(DynamicTable pivotTable) {
this.pivotTable = pivotTable;
}
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
public class DynamicTable implements Serializable {
private static final long serialVersionUID = 7863262235394607247L;
private List<ColumnModel> columns;
private List datas = new ArrayList();
private String entityName;
private GenericManager<BaseObject, Long> manager;
private Method m;
public DynamicTable(String entityName) {
this.entityName = entityName;
}
public String getEntityName() {
return entityName;
}
public void setEntityName(String entityName) {
if (this.entityName == null) {
this.entityName = entityName;
}
}
/**
* Méthode permettant de récupérer la liste des données du tableau
*
* @return La liste des données en fonction de l'entité
*/
public List getDatas() {
if (this.getEntityName() != null) {
manager = ManagerUtils.getEntityManager(this.getEntityName());
if (manager != null) {
datas = manager.getAll();
return datas;
}
}
return null;
}
/**
* Méthode permettant de récupérer la liste des colonnes du tableau
*
* @return La liste des colonnes contenu dans le fichier json
* @throws org.json.JSONException
*/
public List<ColumnModel> getColumns() throws JSONException {
try {
JSONObject mJsonObj = FileReaderUtil.loadJSONFile("poste.json");
JSONArray jsonColumns = mJsonObj.getJSONArray("columns");
columns = new ArrayList<ColumnModel>();
for (Object object : jsonColumns) {
JSONObject jsonColumn = (JSONObject) object;
columns.add(new ColumnModel(jsonColumn.getString("header"), jsonColumn.getString("property")));
}
return columns;
} catch (IOException ex) {
Logger.getLogger(DynamicTable.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
} |
Merci d'avance.
Transact.