<!DOCTYPE html> <html> <head> <title>Hello Scalate!</title> </head> <body> <h1>Welcome to Scalate Core</h1> <p>This is a sample template.</p> <ul> @for(item <- items) { <li>@item</li> } </ul> </body> </html> import org.scalate.Scalate public class TemplateRenderer { public static void main(String[] args) { String templatePath = "/path/to/template.html"; String template = Scalate.loadTemplate(templatePath); Map<String, Object> model = new HashMap<>(); List<String> items = Arrays.asList("Item 1", "Item 2", "Item 3"); model.put("items", items); String result = Scalate.renderTemplate(template, model); System.out.println(result); } }


上一篇:
下一篇:
切换中文