Jfinal Framework Tutorial-Learning Notes

Source: Internet
Author: User
Tags sin fast web

Jfinal Framework Tutorial-Learning Notes

Jfinal is a fast WEB + ORM development framework based on the Java language, whose core design goals are rapid development, low code, simple learning, powerful, lightweight, easy to expand, Restful. With all the advantages of the Java language, but also have Ruby, Python, PHP and other dynamic language development efficiency! Save more time for you, to accompany lovers, family and friends! (Applause!~~)

Jfinal has the following main features:
? MVC Architecture, compact design, easy to use
? Follow COC principle, 0 configuration, no XML
? Unique Db + Record mode for flexibility and convenience
? ActiveRecord support to make database development extremely fast
? Automatic loading of modified Java files without restarting the Web server during development
? AOP support with flexible interceptor configuration and powerful features
? Plugin Architecture, strong extensibility
? Multi-view support, support Freemarker, JSP, Velocity
? Powerful Validator back-end Check function
? Fully functional, with struts2 most core functions
? Small size of only 218K, and no third-party dependencies

The official recommendation is to use the Eclipse IDE for Java EE developers as the development environment, but I am used to the Myecllipse+tomact

Eclipse IDE for Java EE developers

1. Create a Dynamic Web Project

2, modify the Default Output Folder, the recommended input webroot\web-inf\classes

Special Note: The Default out folder here must be associated with the Webroot\web-inf\classes directory
Fully consistent, you can use jfinal integrated Jetty to start a project.

3, modify Content directory, recommended input WebRoot

Note: The default value of WebContent can also be used here, but the previous step
Webroot\web-inf\classes need to change to webcontent\web-inf\classes to correspond.

4, go to the official website to download the latest jar package (I this is jfinal-lib-1.4)

Put Jetty-server-8.1.8.jar and Jfinal-bin-1.4.jar under the project Web-inf\lib, Jetty-server-8.1.8.jar is the operating environment used in the development process and is not needed in tomact and production environments.

5. Add to 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& Gt;/*</url-pattern></filter-mapping>       

6. Create the demo package under the Project SRC directory and create the Democonfig file under the demo package as follows:

PackageDemoImport com.jfinal.config.*;PublicClass DemoconfigExtendsJfinalconfig {PublicvoidConfigconstant (Constants me) {Me.setdevmode (True);}PublicvoidConfigroute (Routes me) {me.add ("/hello", Hellocontroller.Class);}PublicvoidConfigplugin (Plugins me) {}public void configinterceptor (interceptors me) {}public void Confighandler (handlers Me) {}} 

Note: The package that contains the Democonfig.java file and its own file name must match the configuration in the Param-value tag in Web. XML (in this case, the configuration is demo.) Democonfig).

Under the demo package, create a Hellocontroller class file that reads as follows:

PackageDemoImportCom.jfinal.core.Controller;PublicClass Hellocontrollere Xtends Controller {public void index () {RenderText ("Hello jfinal World") );}} 

6. Right-click the project name to select Com.jfinal.core.JFinal OK
7, the browser input Http://localhost/hello output content for Hello jfinal World Certification Project framework is completed.

Note: When developing or running a project under Tomcat, you need to remove the Jetty-server-xxx.jar package first, or it will cause a conflict.

(Copy the official website api, sin sin ...)

Jfinal really quite simple, fast, powerful a framework, no SSH n multiple XML config file, followed by a simple student information management, with Freemarker

Jfinal Framework Tutorial-Learning Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.