You write:
---begin---
Yes, this is part of what I was looking for -- this is a benefit of decoupling the HTML document from the templating language.
---end---
This is how WebObjects does templating/components (and Tapestry, since it's based on WebObjects concepts).
Suppose you have a WebObjects component (WOComponent) called Example. You'll have an Example.java file for the Example class, and an Example.wo directory containing two files: Example.html and Example.wod.
The .html file defines the presentation of the component, and can contain WEBOBJECT tags for including other dynamic elements or subcomponents. The WEBOBJECT tags will have a name="..." attribute whose value will match a block in the .wod file.
The .wod file contains the bindings between the LoginForm.html file and the LoginForm.java class. (The .java file isn't kept in the .wo folder, typically in the same folder as the .wo is in)
Example.html file:
This <WEBOBJECT Name="foo"></WEBOBJECT> is a string.
Example.wod file:
foo: WOString {
value = myString;
}
Example.java file:
public class Example extends WOComponent {
public Example(WOContext c) { super(c); }
public String myString() { return "thing"; }
}
The result of rendering that component is:
"This thing is a string."
This is obviously a simple example that hardly shows the power of what WOComponents can do, but shows you how the "code" is out of the HTML, so to speak.
What is interesting about ZPT/TAL (I have been learning Zope recently so I'm getting familiar with it) is it doesn't use is own tag names but instead these attributes on common HTML tags...
like:
This <span tal:content="here/myString">dummy text</span> is a string.
I like that because it can be loaded into Dreamweaver and will show something representative of what the end result will be, unlike loading the .html file of a .wo component. Dreamweaver doesn't know about WEBOBJECT tags.
However, your idea (and Evan Simpson's on the ZPT list pointed to earlier) about using CSS files is truly excellent. It gives the best of the WO and ZPT worlds: It can use standard HTML tags instead of domain-specific tags (ie: WEBOBJECT), and puts the code in a different file than the HTML, the weakness of ZPT/TAL.
I think WO and Zope would benefit from this addition to their respective templating systems.
And JSP... throw it out the door already! The concept sucked when it was called ASP, and using Java instead of VBScript was never going to make it any better. :(
Jim Roepcke
|