Posts Tagged ‘ SiteMesh ’

ASP.NET MasterPages and SiteMesh

It’s nice to see the SiteMesh approach catching on… ASP.NET 2.0 includes a features called MasterPages, which is a kind of hybrid of SiteMesh and Tiles .

Specifying a master page with ASP.NET is similar to how you do with SiteMesh – a plain HTML page containing common look and feel, with placeholders for the actual content. However with master pages, you need to change the actual pages serving the content to map fragments of content back to the place holders in the master page. This adds yet more noise to typically already noisy ASP.NET pages – a minor downer.

Overall, it’s looking pretty promising. A nice bonus is how the page designer in VS.NET will render your master page when editing content pages, but grey it out. Look.

Anyhoo… I’ll be demonstrating SiteMesh.NET and talking about MasterPages at the Bangalore .NET User Group tomorrow (Thursday) night. If you’re in the area, please drop on by.

StaticMesh first cut

Rune Toalango Johannesen has created a first cut of StaticMesh – an offline version of SiteMesh for building static web-sites.

Like SiteMesh, it takes a plain HTML document (content) and an HTML decorator (presentation) to generate some pretty content as its output.

Unlike SiteMesh, it does not require a runtime Servlet engine to do this. It gets it content and decorators from files and outputs to more files.

You can run it as a standalone application, embed it in existing apps or use Ant to invoke it.

The Ant task usage is as simple as you’d expect:

Content pages are plain old HTML. Anything can generate these (even MS Word!).

Decorators are also plain HTML with lots of prettyness. SiteMesh parses the content pages, which are made available to the decorator using Velocity variables such as $title and $body. Velocity is very friendly and doesn’t confuse web-development tools such as DreamWeaver.

SiteMesh.NET in CVS

Jeremy Clymer has ported SiteMesh to .NET. And it works like a charm!

Here’s the feedback that I’ve had so far.

bq. “SiteMesh.NET rocks dude!”

bq. “I downloaded and it just worked.”

You can get it from “CVS”: if you can’t wait for a release. It’s already stable.