Brian's Waste of Time

Tue, 05 Aug 2003

Form Tool
So I got tired of not having a "low-dependency" HTML form tool that allowed for structured form data. Form Tool gets born. It basically takes a Properties file (made it Properties as it relies on everything being a String) and builds an object graph from it. Starting with the properties:

one.two.three = normal a.b.c = special one.two.four = other a.two = never
It will build graph of objects for you that will play nicely with JXPath and BeanUtils variously. Accessing the model directly works like:
Model model = new Model(props); // Where props contains the above mentioned properties model.getRoot().getChild("one").getChild("two").getChild("three").getValue(); // == "normal" // or more conveniently for BeanUtils model.getRoot().getChild("one").getChild("two").get("three"); // == "normal" model.getRoot().getChild("a").get("two"); // == "never"
Right now I am playing with making it play nicely with BeanUtils, but as I am not super familiar with BeanUtils inner workings yet I haven't messed with nested properties, or really even making copy props work (need to investigate its inner workings). I may wind up reimplemting somehting like it to do bean population, particularly if I want nested stuff (ie, copying properties from graph to graph).

Think I will see if a Jakarta-Commons-er knows enough to point me the right way on copying graphs - would be very convenient if I didna have to reimplement. So many people are stuck using BeanUtils anyway anymore (as was best put by someone else, commons-* libraries are like warts -- they are all so codependent it hurts).

0 writebacks [/src/java] permanent link