This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Groovy and the fly likes groovy's html builder.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "groovy Watch "groovy New topic

groovy's html builder....

Vimala Shirur

Joined: Jan 12, 2001
Posts: 12
How to use groovy's html builder to include css file, table stuff, image stuff etc.,

Could someone show me an example how to do this?

Appreciate your response!

Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

The two code snippets below represent:
1) a script that builds the html markup and then outputs the contents with println writer.toString()
2) the result html

The example includes css, a table, and an image.

[ July 04, 2008: Message edited by: Marc Peabody ]

A good workman is known by his tools.
Vimala Shirur

Joined: Jan 12, 2001
Posts: 12
This helps. Thanks!
Matthew Taylor

Joined: Jun 13, 2004
Posts: 110

If you are doing this sort of thing a lot, I would recommend checking out Grails, which is a web framework build using Groovy and Java. It uses GSPs (like JSPs) for this sort of work,

Grails Consultant
jQuery in Action, 3rd edition
subject: groovy's html builder....
It's not a secret anymore!