voyent
DynaBean  XML
Forum Index -> General Help
Author Message
futhark77

Joined: 18/Sep/2009 00:00:00
Messages: 57
Offline


Hello,

Is it possible to read DynaBean properties from ICEFaces? I tried that yesterday but it didn't work. I received errors about missing properties, even though these properties exist.

What would be a good alternative or workaround to make DynaBean work?

Thanks!
futhark77

Joined: 18/Sep/2009 00:00:00
Messages: 57
Offline


Here's an example showing my problem.

I have a simple DynaBean created from json-lib:

Code:
     JSONObject o = JSONObject.fromObject("{\"key1\":null, \"key2\":\"str\", \"key3\": {\"bool\":false}}");
     DynaBean dyn = (DynaBean) JSONObject.toBean(o);
 


I have defined a getter for the bean and another for one of its fields:

Code:
     public DynaBean getDyn() {
         return dyn;
     }
     public String getKey2() {
         return (String) b.get("key2");
     }
 


First I did a test to prove my DynaBean is ok. In my ICEFaces page, I added this. It printed "str" as expected:

Code:
 <ice:outputText value="#{ClaimSearchBean.key2}"/>
 


Next, I tried to access the field via the bean. That didn't work. I got a javax.el.PropertyNotFoundException: Property 'key2' not found on type net.sf.ezmorph.bean.MorphDynaBean.

Code:
 <ice:outputText value="#{ClaimSearchBean.dyn.key2}"/>
 


This is very unfortunate. I am collecting data from external programs in Json form and I want to display it as directly as possible. I didn't want to have to declare beans before I could display my data.

Any help would be much appreciated.
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team