Apache Wicket is really good, it is feasible to put a whole editable
table grid in a form and have Apache Wicket handle the whole data
binding for each row and column fields and in which the whole list of
beans (pojo objects with getters / setters) with updates can be
retrieved in onSubmit()
A sketch of the trick is like this:
It is similar to implementing a DataView
https://nightlies.apache.org/wicket/guide/9.x/single.html#_component_dataview
But that instead of simply adding Labels:
- The dataview should be populated with a List<Beans>, the Beans being:
https://en.wikipedia.org/wiki/JavaBeans
- Then that in each <td> ... </td> cell, that needs to be a field e.g.
TextField in which
each field in the bean is bound with e.g. new TextField("field", new
PropertyModel<>(object, "fieldName"););
for the whole list of beans and every field
Apache Wicket handles the rendering of the List of beans into the table
of TextFields (<input type="text" ... ) and when the form is submitted
bind the posted from data back into the List<Bean>.
It is almost 'magic', but that I think there is a cost to it as in
practical terms, the whole list of beans and all that
PropertyModel<>(object, "fieldName"); bindings and TextField bindings
needs to be kept as state to handle the form submission.
It is nevertheless very convenient and I'd think it would be good to put
this in the wiki somewhere.
I think this significantly simply / reduce codes , spaghetti html, not
seen in other frameworks and zero javascript.
The world has migrated to javascript frameworks which is browser
dependent and tends to use bulk lot of memory on the client side just
for those (especially heavy) frameworks alone. Those would reasonably
run even slower on mobile devices if at all.
Apache wicket did all that component based web generating all the same
DOM elements which is commonly done in React, Angular JS etc.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]