标签:配置 时间 ali 框架 charset mode stat code vat
<dependencies>
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon.boot.jdkhttp</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon.serialization.snack3</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon.view.enjoy</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
补充说明:
//资源路径说明(不用配置)
resources/application.properties(或 application.yml) 为应用配置文件
resources/static/ 为静态文件根目标
resources/WEB-INF/view/ 为视图文件根目标(支持多视图共存)
//模板调试模式(或加热加载模式):
启动参数添加:-deubg=1
public class JdkApp {
public static void main(String[] args) {
XApp.start(JdkApp.class, args);
}
}
@XBean("view:footer")
public class FooterTag extends Directive {
@Override
public void exec(Env env, Scope scope, Writer writer) {
StringBuffer sb = new StringBuffer();
sb.append("<footer>");
sb.append("我是自定义标签,FooterTag");
sb.append("</footer>");
try {
writer.write(sb.toString());
}catch (Exception ex){
ex.printStackTrace();
}
}
}
@Data
public class UserModel {
private long id;
private String name;
private int sex;
private String label;
}
@XController
public class HomeController {
@XMapping(value = "/", produces = "text/html;charset=utf-8")
public String home(){
return "<a href='/helloworld'>/helloworld</a>";
}
}
@XController
public class HelloworldController {
@XMapping("/helloworld")
public Object helloworld(){
UserModel m = new UserModel();
m.setId(10);
m.setName("刘之西东");
m.setSex(1);
ModelAndView vm = new ModelAndView("helloworld.shtm");
vm.put("title","demo");
vm.put("message","hello world!");
vm.put("m",m);
return vm;
}
}
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>#(title)</title>
</head>
<body>
<div>
#(m.name) : #(message) (我想<a href="/jinjin.htm">静静</a>)
</div>
#footer()
</body>
</html>
标签:配置 时间 ali 框架 charset mode stat code vat
原文地址:https://www.cnblogs.com/noear/p/12103742.html