当前位置 : 主页 > 编程语言 > c++ >

JFinal 是基于 Java 语言的极速 WEB + OR

来源:互联网 收集:自由互联 发布时间:2021-06-30
README.md ### JAVA 极速WEB+ORM框架 JFinalJFinal 是基于 Java 语言的极速 WEB + ORM 框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、Restful。在拥有Java语言所
README.md
### JAVA 极速WEB+ORM框架 JFinal


JFinal 是基于 Java 语言的极速 WEB + ORM 框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、Restful。在拥有Java语言所有优势的同时再拥有ruby、python等动态语言的开发效率!为您节约更多时间,去陪恋人、家人和朋友 ;)

#### JFinal有如下主要特点
- MVC架构,设计精巧,使用简单
- 遵循COC原则,零配置,无xml
- 独创Db + Record模式,灵活便利
- ActiveRecord支持,使数据库开发极致快速
- 极简、高性能Template Engine,十分钟内掌握基本用法
- 自动加载修改后的java文件,开发过程中无需重启web server
- AOP支持,拦截器配置灵活,功能强大
- Plugin体系结构,扩展性强
- 多视图支持,支持FreeMarker、JSP、Velocity
- 强大的Validator后端校验功能
- 功能齐全,拥有struts2的绝大部分功能
- 体积小仅580K

**JFinal 极速开发微信公众号欢迎你的加入: JFinal**

#### 以下是JFinal实现Blog管理的示例:

**1. 控制器(支持JFinal Template、JSP、Velocity、JSON等等以及自定义视图渲染)**

```java
@Before(BlogInterceptor.class)
public class BlogController extends Controller {
    static BlogService service = new BlogService();

    public void index() {
        setAttr("blogPage", service.paginate(getParaToInt(0, 1), 10));
        render("blog.html");
    }

    public void add() {
    }

    @Before(BlogValidator.class)
    public void save() {
        getModel(Blog.class).save();
        redirect("/blog");
    }

    public void edit() {
        setAttr("blog", service.findById(getParaToInt()));
    }

    @Before(BlogValidator.class)
    public void update() {
        getModel(Blog.class).update();
        redirect("/blog");
    }

    public void delete() {
        service.deleteById(getParaToInt());
        redirect("/blog");
    }
}
```

**2.Service所有业务与sql全部放在Service层**

```java
public class BlogService {
    private static final Blog dao = new Blog().dao();
    
    public Page
 
   paginate(int pageNumber, int pageSize) {
        return dao.paginate(pageNumber, pageSize, "select *", "from blog order by id asc");
    }
    
    public Blog findById(int id) {
        return dao.findById(id);
    }
    
    public void deleteById(int id) {
        dao.deleteById(id);
    }
}
```

**3.Model(无xml、无annotaion、无attribute)**

```java
public class Blog extends Model
  
    { } ``` **4.Validator(API引导式校验,比xml校验方便N倍,有代码检查不易出错)** ```java public class BlogValidator extends Validator { protected void validate(Controller controller) { validateRequiredString("blog.title", "titleMsg", "请输入Blog标题!"); validateRequiredString("blog.content", "contentMsg", "请输入Blog内容!"); } protected void handleError(Controller controller) { controller.keepModel(Blog.class); } } ``` **5.拦截器(在此demo中仅为示例,本demo不需要此拦截器)** ```java public class BlogInterceptor implements Interceptor { public void intercept(Invocation inv) { System.out.println("Before invoking " + inv.getActionKey()); inv.invoke(); System.out.println("After invoking " + inv.getActionKey()); } } ``` **JFinal 官方网站:[http://www.jfinal.com](http://www.jfinal.com)**
  
 
pom.xml
 
	
  
   4.0.0
  
	
  
   com.jfinal
  
	
  
   jfinal
  
	
  
   jar
  
	
  
   JFinal
  
	
  
   3.2-SNAPSHOT
  
	
  
   http://www.jfinal.com
  
	
  
   JFinal is a simple, light, rapid,independent, extensible Java WEB + ORM framework. The feature of JFinal looks like ruby on rails especially ActiveRecord.
  
	
	
   
   
    UTF-8
    
   
    UTF-8
    
  
	
	
   
   
    Github Issue
    
   
    http://git.oschina.net/jfinal/jfinal/issues
    
  
	
   
    
    
     The Apache Software License, Version 2.0
     
    
     http://apache.org/licenses/LICENSE-2.0.txt
     
    
  
	
   
    
    
     jfinal
     
    
     James
     
    
     jfinal@126.com
     
    
     http://jfinal.com/user/1
     
    
  
	
   
   
    scm:git:git@git.oschina.net:jfinal/jfinal.git
    
   
    scm:git:git@git.oschina.net:jfinal/jfinal.git
    
   
    git@git.oschina.net:jfinal/jfinal.git
    
  
	
	
   
   
    org.sonatype.oss
    
   
    oss-parent
    
   
    7
    
  

	
   
  
	
   
    
    
     junit
     
    
     junit
     
    
     4.8.2
     
    
     test
     
    
    
    
     com.jfinal
     
    
     jetty-server
     
    
     8.1.8
     
    
     provided
     
    
    
    
    
    
     org.eclipse.jetty
     
    
     jetty-jsp
     
    
     8.1.8.v20121106
     
    
     provided
     
    
    
    
    
     com.mchange
     
    
     c3p0
     
    
     0.9.5.1
     
    
     provided
     
    
    
    
     com.alibaba
     
    
     druid
     
    
     1.0.29
     
    
     provided
     
    
    
    
     com.alibaba
     
    
     fastjson
     
    
     1.2.31
     
    
     provided
     
    
    
    
     com.zaxxer
     
    
     HikariCP-java6
     
    
     2.3.13
     
    
     provided
     
    
    
    
     net.sf.ehcache
     
    
     ehcache-core
     
    
     2.6.6
     
    
     provided
     
    
    
    
     org.freemarker
     
    
     freemarker
     
    
     2.3.20
     
    
     provided
     
    
    
    
     log4j
     
    
     log4j
     
    
     1.2.16
     
    
     provided
     
    
    
    
     org.apache.velocity
     
    
     velocity
     
    
     1.7
     
    
     provided
     
    
    
    
     org.apache.velocity
     
    
     velocity-tools
     
    
     2.0
     
    
     provided
     
    
    
    
     com.jfinal
     
    
     cos
     
    
     2017.5
     
    
     provided
     
    
    
    
     cglib
     
    
     cglib-nodep
     
    
     3.2.5
     
    
    
    
     redis.clients
     
    
     jedis
     
    
     2.7.2
     
    
     provided
     
    
    
    
     de.ruedigermoeller
     
    
     fst
     
    
     2.29
     
    
     provided
     
    
    
    
    
     com.fasterxml.jackson.core
     
    
     jackson-databind
     
    
     2.4.3
     
    
     provided
     
    
    
    
     it.sauronsoftware.cron4j
     
    
     cron4j
     
    
     2.2.5
     
    
     provided
     
    
    
    
     com.google.zxing
     
    
     javase
     
    
     3.2.1
     
    
     provided
     
    
    
    
     org.springframework
     
    
     spring-webmvc
     
    
     4.3.8.RELEASE
     
    
     provided
     
    
  
	
	
   
    
     
     
      org.apache.maven.plugins
      
     
      maven-compiler-plugin
      
     
      3.6.1
      
      
      1.6 
      
       1.6
       
      
     
     
     
      org.apache.maven.plugins
      
     
      maven-javadoc-plugin
      
     
      2.10.3
      
      
       
      
       -Xdoclint:none
       
      
       UTF-8
       
      
       ${basedir}
       
      
       ${basedir}
       
      
     
     
     
     
      org.apache.maven.plugins
      
     
      maven-source-plugin
      
     
      2.1.2
      
      
       
       
        attach-sources
        
       
        verify
        
        
        
         jar-no-fork
         
        
       
      
     
     
     
      org.apache.maven.plugins
      
     
      maven-gpg-plugin
      
     
      1.1
      
      
       
       
        sign-artifacts
        
       
        verify
        
        
        
         sign
         
        
       
      
      
      
       true
       
      
     
    
  

 
.gitignore
# maven #
target

logs

# eclipse #
.settings
.project
.classpath
.log

# windows #
Thumbs.db

# Mac #
.DS_Store

# Package Files #
*.war
*.ear

# idea #
.idea
*.iml

plan.txt

*.class

# Package Files #
*.jar


*.bak
*.tmp
*.log
/bin/
build.sh
integration-repo
/build/

# IDEA metadata and output dirs
*.ipr
*.iws

/webapp/WEB-INF/classes/
/webapp/WEB-INF/test-classes/
/webapp/WEB-INF/target/

a_little_config_pro.txt

dev_plan.txt
网友评论