Blog Code Entanglement

24 September 2003

Between trying to use CSS to its fullest and trying to optimally use Struts, I have quite the rat's nest of code here. I should put up snapshots of my disasters in layout. Often I end up with all my on-screen components completely overlapping each other.

Struts also provides a quick and easy way to plug new functionality, but I struggle trying to find the appropriate places for code to live.

The data model is obviously contained in entity beans, and the business logic in the session bean. I have a good handle on those, but I'm not as clear on the web tier. Struts actions provide presentation logic and JSP provides the actual layout. The question lies in the best placement for logic involving layout, like where should I calculate the comment count? Since it's a function of the display, I tend to do it in spaghetti code in the JSP. I think I'm protecting my Action too much. When I change layouts, I should probably expect to change the Actions completely as well.

It's not all bad though -- Struts allows me to plug in functionality pretty quickly, like the getExpandedView() capability. I have a lot of work to do still. I'm confident that this will click sometime soon, and it'll be proven worthwhile.


Filed Under: Java Blog-Code Computers