<dependency>
<groupId>org.webmacro</groupId>
<artifactId>WebMacro</artifactId>
<version>2.1</version>
</dependency>
properties
webmacro.TemplateDir = templates
webmacro.CachingOn = true
html
<html>
<head>
<title>${title}</title>
</head>
<body>
<h1>${heading}</h1>
<p>${content}</p>
</body>
</html>
import org.webmacro.Context;
import org.webmacro.servlet.WebContext;
public class WebMacroExample {
public static void main(String[] args) {
Context context = new WebContext();
context.put("webmacro.TemplateDir", "/path/to/templates");
context.put("title", "WebMacro Example");
context.put("heading", "Welcome to WebMacro");
context.put("content", "This is a dynamic webpage generated using WebMacro.");
String result = context.getRenderer().render("template.wm");
System.out.println(result);
}
}