jfinal is based on Java the speed of language WEB + ORM Development Framework whose core design objective is to develop
Fast, less code, learning simple, powerful, lightweight, easy to expand, Restful . In the owning Java
with all the advantages of the language. Ruby , python , PHP the development efficiency of such dynamic language !
jfinal has the following main features:
L MVC Architecture, compact design, easy to use
L Follow COC principle, 0 configuration, none XML
L Original Db + Record mode, flexible and convenient
L ActiveRecord support, making database development extremely fast
L automatic loading of modified Java files that do not need to be restarted during development Web Server
L AOP support, the interceptor configuration is flexible and powerful
L Plugin architecture, Strong extensibility
L Multi-view support, support Freemarker , JSP , Velocity
L Powerful, Validator Back-end Check function
L fully functional, with struts2 Most core functions
L Small size only 303K , and no third-party dependencies
Next, you'll actually create a small project. First, create a Dynamic Web Project
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7F/06/wKioL1cQfoPQ_ThqAADTzY3D4dc750.png "title=" Picture 1.png "alt=" Wkiol1cqfopq_thqaadtzy3d4dc750.png "/>
Fill in the project basic information
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/09/wKiom1cQfdbR4fChAAFhHyhM7g0260.png "title=" Picture 2.png "alt=" Wkiom1cqfdbr4fchaafhhyhm7g0260.png "/>
Note:Target runtime must choose <None>
Modify the default Output Folder, recommended Input webroot\web-inf\classes
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7F/09/wKiom1cQfeHD1UhzAADPFs27lT4160.png "title=" Picture 3.png "alt=" Wkiom1cqfehd1uhzaadpfs27lt4160.png "/>
Note: The Default out folder here must be exactly the same as the webroot\web-inf\classes directory to
To start the project using jfinal integrated Jetty .
Modify content directory, recommended input WebRoot
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/09/wKiom1cQfenS7cRgAADLQiSzHdg129.png "title=" Picture 4.png "alt=" Wkiom1cqfens7crgaadlqiszhdg129.png "/>
Note: The default value webcontentcan also be used here, but the webroot\web-inf\classes in the previous step needs to be changed to webcontent\ Web-inf\classes to the corresponding.
Put Jfinal library file
Copy the Jfinal-xxx.jar and Jetty-server-8.1.8.jar to the project web-inf\lib Next.
Note:Jetty-server-8.1.8.jar is a running environment that is used at development time, and this file is not required for production environments.
Modify Web. xml
Add the following to the Web. XML
<filter>
<filter-name>jfinal</filter-name>
<filter-class>com.jfinal.core.JFinalFilter</filter-class>
<init-param>
<param-name>configClass</param-name>
<param-value>demo. Democonfig</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>jfinal</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
adding Java files
Create the demo package under the project src directory and create the democonfig file under the demo package , The contents are as follows:
Package demo;
Import com.jfinal.config.*;
public class Democonfig extends Jfinalconfig {
public void Configconstant (Constants me) {
Me.setdevmode (TRUE);
}
public void Configroute (Routes me) {
Me.add ("/hello", Hellocontroller.class);
}
public void Configplugin (Plugins me) {}
public void Configinterceptor (interceptors me) {}
public void Confighandler (handlers me) {}
}
Note: The package that contains theDemoconfig.java file and its own file name must be the same as the param-value in Web . xml
The configuration in the check is consistent ( In this case, the configuration is demo.) Democonfig).
Under the demo package, create a Hellocontroller class file that reads as follows:
Package demo;
Import Com.jfinal.core.Controller;
public class Hellocontroller extends Controller {
public void index () {
RenderText ("Hello jfinal World");
}
}
Start Project
Create the startup entry as shown in:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/06/wKioL1cQfq6QLdDVAAA9lqWUDr0824.png "title=" Picture 5.png "alt=" Wkiol1cqfq6qlddvaaa9lqwudr0824.png "/>
Right-click on Java application and select new menu item to create The Java application startup item
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/06/wKioL1cQfrfSUn8nAAA3NxkpVxw933.png "title=" Picture 6.png "alt=" Wkiol1cqfrfsun8naaa3nxkpvxw933.png "/>
In the right window, fill in the Main class input Box : Com.jfinal.core.JFinal and click Debug button Startup Item
As shown in the following items:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7F/09/wKiom1cQfgqTiXnbAAEBYdRVJGs311.png "title=" Picture 7.png "alt=" Wkiom1cqfgqtixnbaaebydrvjgs311.png "/>
Open the browser to see the effect
Open the browser in the address bar input : Http://localhost/hello, the output is the Hello jfinal World Certification Project
The frame is built to completion.
The use of jfinal has been a period of time, deeply appreciate its convenience, and strongly share to everyone, specially organized a bit about the jfinal of information to share to everyone,/http/ www.36zhen.com/tid=207, if you have any questions, also welcome Dabigatran 413461338 together to discuss learning!
This article is from the "Big Medicine Bottle" blog, please make sure to keep this source http://xiaoqiang1006.blog.51cto.com/6421380/1764125
0 Basic Small white user can also understand! Recommended Framework for Java practitioners Jfinal (with combat)