<dependency>
<groupId>org.webmacro</groupId>
<artifactId>webmacro</artifactId>
<version>2.0.0</version>
</dependency>
html
<html>
<head>
<title>${title}</title>
</head>
<body>
<h1>Welcome to ${title}</h1>
<p>${message}</p>
</body>
</html>
import org.webmacro.servlet.WebContext;
import org.webmacro.servlet.WebResponse;
public class Main {
public static void main(String[] args) {
WebContext context = new WebContext();
context.put("title", "WebMacro Tutorial");
context.put("message", "Hello, WebMacro!");
WebResponse response = new WebResponse();
try {
response.setContent(context.evaluateTemplate("index.wm"));
System.out.println(response.getContent());
} catch (Exception e) {
e.printStackTrace();
}
}
}