O'Reilly logo

ExtGWT Rich Internet Application Cookbook by Odili Charles Opute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Formatting data with a basic template

The template class in the GXT toolkit provides a very simple mechanism for generating formatted HTML fragments from data objects which can be instances of ModelData or Params.

Once we apply the data to the Template object, the result is the formatted HTML interpolated with values from the provided data.

Formatting data with a basic template

How to do it...

Instantiate a Template object with a string representing the desired HTML formatting and the placeholders. We will replace the Template placeholders with values using a Params object.

//Local convenience method private String getTemplate(){ StringBuilder sb = new StringBuilder(); sb.append("<p>Age: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required