Thursday, January 12, 2006

Thinking About Java Web Frameworks

So I've been thinking a lot about ways to solve a problem I'm having at work. Simplifying JSP templates without having to build backing bean/classes for every page.

From what I can tell, and my knowledge is very limited due to time constraints, most of the frameworks that do a good job of simplifying front end development require the developer to build some sort of class that backs that page. As an example, it appears that Tapestry, not to pick on them, requires you to have mypage.html Mypage.class and and a config file to map bindings.

My requirements are a bit different I suppose than most. I have an API that is used to grab various values out of a hidden XML like structure. The structure is basically Containers and Values. A Container can hold containers to better struture the data.

So as an example:

Container - Name=Address
Container - Name=Line Count=0
Value - Name=Text [Joe Blo] - Value
- Container
Container - Name=Line Count=1
Value - Name=Text [
Bubble Gum Avenue] - Value
- Container

Container - Name=Line Count=2
Value - Name=Text [
Youbetcha, AK] - Value
- Container
- Container

Apoligies for the format, Blogger's not XML friendly, and I'm feeling lazy.

So I've got a loosely defined object model, where what the object is and what it contains are defined by the Name of the object. The model is not static depending upon what customer the data arrives from.

So today, we use JSP with pure Java contstucts to pull the values out. I can do a getContainer(name) and do a getContainer(name).getContainer(name).getValue(name). I can do a getContainerCount(name) and use the value to create a for loop and write out each Address line.

What I'm wanting to do is remove this. It seems like Tapestry and WebWork could do this through OGNL. But If I have to author a new class for each of these guys, then my development lifecycle goes up, deployment becomes more difficult (don't get me shouldn't be, but it is), and everything becomes more complex.

However, if it would be possible to say in Tapestry, bind multiple HTML templates to a backing page, and make the config files be loaded dynamically so I don't have to recycle the server, hence making all of the guys on my team have to be up at the wee hours of the morning to make it happen....then maybe Tapestry would work.

Is there anything out there that allows a loose coupling between pages and backing objects instead of having it be very strict?

No comments: