[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Dynamic Grid Filling via Introspection hashmap error on numeric key  XML
Forum Index -> Development
Author Message
becherer

Active
[Avatar]

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)
...

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

...could you try:

Code:
 .{record["00003"]}
 


instead of

Code:
 .{record.00003}
 


Björn

Björn Müller, CaptainCasa GmbH
becherer

Active
[Avatar]

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

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
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
becherer

Active
[Avatar]

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

becherer

Active
[Avatar]

Joined: 28/11/2007 18:16:59
Messages: 20
Offline

...ignore the last post, please...

;-)

thnx again!
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team