Author |
Message |
18/12/2008 12:12:20
|
becherer
Active
Joined: 28/11/2007 18:16:59
Messages: 20
Offline
|
hi there,
i am running into an general error in a fixgrid, generated dynamically via objectbinding.
Im using a InnerClass
public class resultItem extends FIXGRIDItem{
private HashMap<String, String> record = new HashMap<String, String>();
public resultItem(HashMap<String, String> record){
this.record = record;
}
public HashMap<String, String> getRecord() {
return record;
}
public void setRecord(HashMap<String, String> record) {
this.record = record;
}
}
and build the Fixgrid by using the following code :
FIXGRIDComponentTag fixTag = new FIXGRIDComponentTag();
fixTag.setObjectbinding("#{d.QueryEditorAdapter.resultGrid}");
bc = fixTag.createBaseComponent();
// Columns
HashMap<String, String> oneRecord = res.get(0);
Set<String> keys = oneRecord.keySet();
Iterator<String> siter = keys.iterator();
while(siter.hasNext()){
String key = siter.next();
GRIDCOLComponentTag oneCol = new GRIDCOLComponentTag();
oneCol.setText(key);
LABELComponentTag labelTag = new LABELComponentTag();
labelTag.setText(".{record." + key + "}");
bc.getChildren().add(col);
}
all works fine until a key in the Hashmap is numeric (e.g. "00003"). This causes a nasty stack - do you know a valid workaround?
Stack :
...
Caused by: javax.faces.el.ReferenceSyntaxException: ccqf["d.QueryEditorAdapter.resultGrid.rows[0]"].record.00003
at com.sun.faces.application.ApplicationImpl.checkSyntax(ApplicationImpl.java:749)
at com.sun.faces.application.ApplicationImpl.createValueBinding(ApplicationImpl.java:291)
at org.eclnt.jsfserver.elements.BaseComponentTag.setProperties(BaseComponentTag.java:439)
at org.eclnt.jsfserver.elements.BaseComponentTag.createBaseComponent(BaseComponentTag.java:552)
... 63 more
Caused by: com.sun.faces.el.impl.ElException: Encountered ".00003", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||", "?"]
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.parseExpressionString(ExpressionEvaluatorImpl.java:289)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.parseExpression(ExpressionEvaluatorImpl.java:199)
at com.sun.faces.application.ApplicationImpl.checkSyntax(ApplicationImpl.java:741)
...
|
|
|
18/12/2008 14:09:32
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5555
Offline
|
...could you try:
Code:
instead of
Code:
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
18/12/2008 14:34:43
|
becherer
Active
Joined: 28/11/2007 18:16:59
Messages: 20
Offline
|
thnx captain!
that works - can you explain, why it works with all "non-numeric" Hashmap keys?
thnx in advance!
see ya
|
|
|
18/12/2008 14:42:17
|
CaptainCasa
Power User
Joined: 21/11/2007 12:23:06
Messages: 5555
Offline
|
Well, in principal if you have a map then you can both write ".xyz" or "["xyz"]". The "." notation seems to follow the "common rules" for variable naming, the other one is without any restrictions (e.g. the key also may contain some blanks or some dots inside).
Björn
|
Björn Müller, CaptainCasa GmbH |
|
|
18/12/2008 14:45:33
|
becherer
Active
Joined: 28/11/2007 18:16:59
Messages: 20
Offline
|
thnx captain!
that works - can you explain, why it works with all "non-numeric" Hashmap keys?
thnx in advance!
see ya
|
|
|
18/12/2008 14:46:41
|
becherer
Active
Joined: 28/11/2007 18:16:59
Messages: 20
Offline
|
...ignore the last post, please...
;-)
thnx again!
|
|
|
|