I've been doing some website/web app building in Web Velocity and Seaside today; it is so much easier than working with the server page/servlet model. Instead of a page and a servlet, I had this for a small form:
html form:
[html table:
[html tableRow: [self renderUserRowOn: html].
html tableRow: [self renderPasswordRowOn: html].
isLoggedIn ifTrue: [html tableRow: [self renderFileRowOn: html]].
html tableRow: [self renderButtonRowOn: html]]]
And the code for handling the form is all in the #renderButtonRowOn: method - not sitting in two places (form and servlet). Then there's the whole component based assembly thing. I built the Media Search app, but that mostly used Web Velocity scaffolding - I didn't get into much Seaside level work. Here's the rendering of the main part of the app I was mucking with:
renderContentOn: html
html div
id: #wrapper;
with: [self renderDetailsOn: html]
renderDetailsOn: html
html render: WVHeader new.
html render: WVMain new.
html render: WVFooter new
I know other people have written about this before, but doing this kind of component based assembly in code, as opposed to with html include statements, just makes life simpler. Need to change something? Use the refactoring tools to make changes. Instead of moving back and forth between toolsets, everything is in one place. It's all very cool.
Technorati Tags:
smalltalk, seaside