Tremelune wrote:
I'm wary of complicated frameworks, but considering all of this CRUD is the most annoying part of web development, I'd love to take a look.
Ok, I'm going to post it somewhere when I get it into reasonable shape.
It's not that complicated. The part about it that you will notice is that it has some inflexible naming conventions. In particular, if you have an object with a field called "foo" then the HTML form input has to have a name "foo". This ia actually a good thing because using naming conventions is the only realistic way you can avoid typing tons of meta-data to map one thing to another, and I hate all that.
The other thing it does is it uses some custom tags which are also capable of introspection. So let's say you are writing a web app to help a library manage its collection. You could then use a tag like this:
<SleepyBear:object name="book" field="title"/>
to show the title of a book. How does it do this? First it looks in the page scope for an object named "book". If it's not there, it looks in the request scope. If it's not there, it can (optionally) look in the request parameters for a parameter called bookId, which (if it is present and is an integer) it can use to load a Book object from Hibernate using session.get(). So those are the places it looks for the object.
Once it has found the object, it gets the title by finding the getTitle() method.
But it's even trickier than that. Let's say we want to do this:
<SleepyBear:object name="customer" field="address_city"/>
It will do the same things to find the Customer object. But there's a problem! Address is a component of Customer. There is no method Customer.getAddress_city(). What does it do? It actually notices that there is a Customer.getAddress() method and then notices that there is an Address.getCity() method and does the right thing. The joy of this is that you can then use your Address object all over the place and forms involving addresses will all work, without havng to retype stuff.
And on top of it all, it can generate your forms for you by doing the same introspection. It uses Java 5 annotations to give it hints in some cases.
So I'll post this. I hope there will be enough interest for people to test it out, because it will take me some amount of effort to post it and document it enough to be usable by others.