改配置文件
server {
listen 8899;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
}
生成页面代码 例子
@GetMapping("createIndex")
public Result createIndex() {
//获取后台存储数据
Result result = productFeignClient.getBaseCategoryList();
//设置模版显示内容
Context context = new Context();
context.setVariable("list", result.getData());
//定义文件输出位置
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter("F:\\index.html");
templateEngine.process("index/index.html", context, fileWriter);
fileWriter.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return Result.ok();
}
将生成的静态页面与css 放入html 中即可!(注意copy静态文件)