Discussion:
Quick OGNL question
Ondřej Čada
2012-02-21 14:33:05 UTC
Permalink
Hello there,

among others, I'm exploring the WOOgnl power (quite nice stuff!)

Now I've got a subcomponent whose bindings are "auction" and "field". Auction has methods

// Auction -- the object to which the component's "auction" binding leads
String listFieldValue(Field field) { return .... }
void setListFieldValue(Field field, Strin val) { .... }

The subcomponents contains, among others,

<wo:textfield value = "~auction.listFieldValue(field)"/>

and I was rather surprised seeing the form gets created properly -- the OGNL thing is quite nice :)

Of course, as you probably guessed long ago, self-evidently the form can't save with this binding. Now, is there an OGNL trick to fix it in the HTML/WOD so that it does save all right, or do I have to implement glue code in my component and bind to that, like

// Component glue code
String listFieldValue() { auction.listFieldValue(field) }
void setListFieldValue(String val) { auction.setListFieldValue(field,val) }

<!-- and new binding -->
<wo:textfield value = "$listFieldValue"/>

Thanks and all the best,
---
Ondra Čada
OCSoftware: ***@ocs.cz http://www.ocs.cz
private ***@ocs.cz http://www.ocs.cz/oc

Loading...