Skip to content

Commit d85b175

Browse files
committed
update
1 parent a05da7f commit d85b175

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

jfinal/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.bak
2+
*.class
3+
.project
4+
.classpath
5+
.settings
6+
*.tmp
7+
*.log
8+
bin
9+
build.sh
10+
integration-repo
11+
build
12+
13+
# IDEA metadata and output dirs
14+
*.iml
15+
*.ipr
16+
*.iws
17+
out

jfinal/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
JFinal 是基于Java 语言的极速 WEB + ORM 开发框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、Restful。在拥有Java语言所有优势的同时再拥有ruby、python等动态语言的开发效率!为您节约更多时间,去陪恋人、家人和朋友 ;)
2+
==JFinal主要特点:==
3+
* MVC架构,设计精巧,使用简单
4+
* 遵循COC原则,零配置,无xml
5+
* ActiveRecord支持,使数据库开发极致快速
6+
* 自动加载修改后的java文件,开发过程中无需重启web server
7+
* AOP支持,拦截器配置灵活,功能强大
8+
* Plugin体系结构,扩展性强
9+
* 多视图支持,支持FreeMarker、JSP、Velocity
10+
* 强大的Validator后端校验功能
11+
* 功能齐全,拥有struts2的绝大部分功能
12+
* 体积小仅180K,且无第三方依赖
13+
14+
以下是JFinal实现Blog管理的代码:
15+
{{{
16+
/**
17+
* BlogController
18+
*/
19+
public class BlogController extends Controller {
20+
public void index() {
21+
setAttr("blogList", Blog.dao.find("select * from blog order by id asc"));
22+
}
23+
24+
public void add() {
25+
}
26+
27+
@Before(BlogValidator.class)
28+
public void save() {
29+
getModel(Blog.class).save();
30+
}
31+
32+
public void edit() {
33+
setAttr("blog", Blog.dao.findById(getParaToInt()));
34+
}
35+
36+
@Before(BlogValidator.class)
37+
public void update() {
38+
getModel(Blog.class).update();
39+
}
40+
41+
public void delete() {
42+
Blog.dao.deleteById(getParaToInt());
43+
}
44+
}
45+
46+
47+
/**
48+
* Blog model.
49+
*/
50+
public class Blog extends Model<Blog> {
51+
public static final Blog dao = new Blog();
52+
}
53+
54+
55+
/**
56+
* BlogValidator.
57+
*/
58+
public class BlogValidator extends Validator {
59+
protected void validate(Controller controller) {
60+
validateRequiredString("blog.title", "titleMsg", "请输入Blog标题!");
61+
validateRequiredString("blog.content", "contentMsg", "请输入Blog内容!");
62+
}
63+
64+
protected void handleError(Controller controller) {
65+
controller.keepModel(Blog.class);
66+
}
67+
}
68+
69+
}}}

0 commit comments

Comments
 (0)