Play! Framework -- revolutionizes the concept of "enterprise" = "complicated"

Source: Internet
Author: User

Play! Framework is a project in 1.0, open-source in, and released version in. I have been learning this framework since its release. Now the official version is 1.01, and 1.1 is also updated on a daily basis. You can download the released version and the latest daily version in the http://download.playframework.org.

 

Learning play! In the process, the most common feeling is-it's too simple! It's not about play! It is a simple design framework. On the contrary, play is found everywhere during learning! Design integrity, which even includes website design and learning documents. Play! It is easy to learn and use. Use play! Create a project. All directory structures are automatically created. Play! Instead of the traditional JSP and Servlet technology (which is great), we provide a very easy-to-use MVC framework. Play! Built-in support for JPA and built-in hibernate as the default persistence engine.

 

On play! , Persistence only needs to integrate the model class and add the @ entity annotation:

 

Code

1 ...
2
3 @ Entity
4
5 Public   Class User Extends Model
6
7 {
8
9 Public String name;
10
11 Public String password;
12
13 Public User (string name, string password)
14
15 {
16
17 This . Name = Name;
18
19 This . Password = Password;
20
21 }
22
23 }
24

 

 

 

Then, create a user and save it to the database. You only need one row.Code:

 

 

1 New User ( " Zxsoft " , " Password " ). Save ();

 

 

This is all the code. You do not need to write any mapping configuration files.

Play! The HSQLDB database is also built in. It supports memory databases and is very convenient for project development and testing.

 

Play! The controller uses the naming convention:

 

1 < Form Action = "@ {Application. createuser }" >
2 < Input Name = "Name"   />
3 < Input Name = "Password"   />
4 < Input Type = "Submit" Value = "Create user"   />
5 </ Form >

 

Then, in the application class, create the createuser method:

 

1 ...
2 Public   Class Application {
3 ...
4 Public   Static   Void Createuser (string name, string password)
5 {
6 User user = New User (name, password). Save ();
7 Render (User );
8 }
9 }

 

 

No other configurations are required. Play! The name and password parameters in form are automatically mapped to the createuser method.

 

View layer play! Use the HTML template written in groovy syntax to render it with parameters of the render () method and return the result to the client.

 

All of this requires no configuration.

 

Play! Although simple to use, the scalability is very powerful, and the length limit cannot be detailed. Http://www.playframework.org is play! We recommend that you visit the official website. Play! The document is very detailed. I have a hand-held tutorial on creating a blog engine in this tutorial. I believe that it will definitely help you learn to play after you have done so! Framework, then you will fall in love with her!

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.