|
1 |
| -=========================== |
2 |
| -JAVA 极速WEB+ORM框架 JFinal |
3 |
| -=========================== |
4 |
| - |
5 |
| - JFinal 是基于 Java 语言的极速 WEB + ORM 框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、Restful。在拥有Java语言所有优势的同时再拥有ruby、python等动态语言的开发效率!为您节约更多时间,去陪恋人、家人和朋友 ;) |
6 |
| - |
7 |
| -JFinal有如下主要特点 |
8 |
| ------------------------- |
9 |
| -#. MVC架构,设计精巧,使用简单 |
10 |
| -#. 遵循COC原则,零配置,无xml |
11 |
| -#. 独创Db + Record模式,灵活便利 |
12 |
| -#. ActiveRecord支持,使数据库开发极致快速 |
13 |
| -#. 自动加载修改后的java文件,开发过程中无需重启web server |
14 |
| -#. AOP支持,拦截器配置灵活,功能强大 |
15 |
| -#. Plugin体系结构,扩展性强 |
16 |
| -#. 多视图支持,支持FreeMarker、JSP、Velocity |
17 |
| -#. 强大的Validator后端校验功能 |
18 |
| -#. 功能齐全,拥有struts2的绝大部分功能 |
19 |
| -#. 体积小仅218K,且无第三方依赖 |
20 |
| - |
21 |
| -**JFinal 极速开发QQ群欢迎您的加入: 283446146、222478625、326297041、196337924** |
22 |
| - |
23 |
| -**以下是JFinal实现Blog管理的示例:** |
24 |
| - |
25 |
| -**1. 控制器(支持FreeMarker、JSP、Velocity、JSON等等以及自定义视图渲染)** |
26 |
| - |
27 |
| -:: |
28 |
| - |
29 |
| - @Before(BlogInterceptor.class) |
30 |
| - public class BlogController extends Controller { |
31 |
| - public void index() { |
32 |
| - setAttr("blogList", Blog.dao.find("select * from blog")); |
33 |
| - } |
34 |
| - public void add() { |
35 |
| - } |
36 |
| - |
37 |
| - @Before(BlogValidator.class) |
38 |
| - public void save() { |
39 |
| - getModel(Blog.class).save(); |
40 |
| - } |
41 |
| - |
42 |
| - public void edit() { |
43 |
| - setAttr("blog", Blog.dao.findById(getParaToInt())); |
44 |
| - } |
45 |
| - |
46 |
| - @Before(BlogValidator.class) |
47 |
| - public void update() { |
48 |
| - getModel(Blog.class).update(); |
49 |
| - } |
50 |
| - |
51 |
| - public void delete() { |
52 |
| - Blog.dao.deleteById(getParaToInt()); |
53 |
| - } |
54 |
| - } |
55 |
| - |
56 |
| -**2.Model(无xml、无annotaion、无attribute、无getter、无setter、new |
57 |
| -Blog()这行代码也不是必须)** |
58 |
| -:: |
59 |
| - |
60 |
| - public class Blog extends Model { |
61 |
| - public static final Blog dao = new Blog(); |
62 |
| - } |
63 |
| - |
64 |
| -**3.Validator(API引导式校验,比xml校验方便N倍,有代码检查不易出错)** |
65 |
| - |
66 |
| -:: |
67 |
| - |
68 |
| - public class BlogValidator extends Validator { |
69 |
| - protected void validate(Controller controller) { |
70 |
| - validateRequiredString("blog.title", "titleMsg", "请输入Blog标题!"); |
71 |
| - validateRequiredString("blog.content", "contentMsg", "请输入Blog内容!"); |
72 |
| - } |
73 |
| - |
74 |
| - protected void handleError(Controller controller) { |
75 |
| - controller.keepModel(Blog.class); |
76 |
| - } |
77 |
| - } |
78 |
| - |
79 |
| -**4.拦截器(在此demo中仅为示例,本demo不需要此拦截器)** |
80 |
| - |
81 |
| -:: |
82 |
| - |
83 |
| - public class BlogInterceptor implements Interceptor { |
84 |
| - public void intercept(ActionInvocation ai) { |
85 |
| - System.out.println("Before invoking " + ai.getActionKey()); |
86 |
| - ai.invoke(); |
87 |
| - System.out.println("After invoking " + ai.getActionKey()); |
88 |
| - } |
89 |
| - } |
90 |
| - |
91 |
| - |
92 |
| - |
93 |
| -**支付宝捐助:https://me.alipay.com/jfinal 捐助将用于社区建设与发展** |
94 |
| - |
| 1 | +=========================== |
| 2 | +JAVA 极速WEB+ORM框架 JFinal |
| 3 | +=========================== |
| 4 | + |
| 5 | + JFinal 是基于 Java 语言的极速 WEB + ORM 框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、Restful。在拥有Java语言所有优势的同时再拥有ruby、python等动态语言的开发效率!为您节约更多时间,去陪恋人、家人和朋友 ;) |
| 6 | + |
| 7 | +JFinal有如下主要特点 |
| 8 | +------------------------ |
| 9 | +#. MVC架构,设计精巧,使用简单 |
| 10 | +#. 遵循COC原则,零配置,无xml |
| 11 | +#. 独创Db + Record模式,灵活便利 |
| 12 | +#. ActiveRecord支持,使数据库开发极致快速 |
| 13 | +#. 自动加载修改后的java文件,开发过程中无需重启web server |
| 14 | +#. AOP支持,拦截器配置灵活,功能强大 |
| 15 | +#. Plugin体系结构,扩展性强 |
| 16 | +#. 多视图支持,支持FreeMarker、JSP、Velocity |
| 17 | +#. 强大的Validator后端校验功能 |
| 18 | +#. 功能齐全,拥有struts2的绝大部分功能 |
| 19 | +#. 体积小仅218K,且无第三方依赖 |
| 20 | + |
| 21 | +**JFinal 极速开发QQ群欢迎您的加入: 222478625、326297041、196337924** |
| 22 | + |
| 23 | +**以下是JFinal实现Blog管理的示例:** |
| 24 | + |
| 25 | +**1. 控制器(支持FreeMarker、JSP、Velocity、JSON等等以及自定义视图渲染)** |
| 26 | + |
| 27 | +:: |
| 28 | + |
| 29 | + @Before(BlogInterceptor.class) |
| 30 | + public class BlogController extends Controller { |
| 31 | + public void index() { |
| 32 | + setAttr("blogList", Blog.dao.find("select * from blog")); |
| 33 | + } |
| 34 | + public void add() { |
| 35 | + } |
| 36 | + |
| 37 | + @Before(BlogValidator.class) |
| 38 | + public void save() { |
| 39 | + getModel(Blog.class).save(); |
| 40 | + } |
| 41 | + |
| 42 | + public void edit() { |
| 43 | + setAttr("blog", Blog.dao.findById(getParaToInt())); |
| 44 | + } |
| 45 | + |
| 46 | + @Before(BlogValidator.class) |
| 47 | + public void update() { |
| 48 | + getModel(Blog.class).update(); |
| 49 | + } |
| 50 | + |
| 51 | + public void delete() { |
| 52 | + Blog.dao.deleteById(getParaToInt()); |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | +**2.Model(无xml、无annotaion、无attribute、无getter、无setter、new |
| 57 | +Blog()这行代码也不是必须)** |
| 58 | +:: |
| 59 | + |
| 60 | + public class Blog extends Model { |
| 61 | + public static final Blog dao = new Blog(); |
| 62 | + } |
| 63 | + |
| 64 | +**3.Validator(API引导式校验,比xml校验方便N倍,有代码检查不易出错)** |
| 65 | + |
| 66 | +:: |
| 67 | + |
| 68 | + public class BlogValidator extends Validator { |
| 69 | + protected void validate(Controller controller) { |
| 70 | + validateRequiredString("blog.title", "titleMsg", "请输入Blog标题!"); |
| 71 | + validateRequiredString("blog.content", "contentMsg", "请输入Blog内容!"); |
| 72 | + } |
| 73 | + |
| 74 | + protected void handleError(Controller controller) { |
| 75 | + controller.keepModel(Blog.class); |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | +**4.拦截器(在此demo中仅为示例,本demo不需要此拦截器)** |
| 80 | + |
| 81 | +:: |
| 82 | + |
| 83 | + public class BlogInterceptor implements Interceptor { |
| 84 | + public void intercept(ActionInvocation ai) { |
| 85 | + System.out.println("Before invoking " + ai.getActionKey()); |
| 86 | + ai.invoke(); |
| 87 | + System.out.println("After invoking " + ai.getActionKey()); |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | +**JFinal 官方网站:http://www.jfinal.com** |
0 commit comments