Easy-to-understand modern Magic--play Framework Guide 1

Source: Internet
Author: User
Tags ruby on rails

wow haha, the winter holiday is over, so I opened a new hole .... This time the protagonist is the famous play framework!! So talk less, start the strategy!

1. What is the play Framework?

What is the famous play framework? Of course it's a frame (nonsense!) ), the official definition please check your website: https://www.playframework.com/

As a personal understanding, the play framework is a lightweight, Scala-based Web development framework. The Play framework itself was written in Scala and was inspired and influenced by Ruby on rails during the design process. On the play framework basis, developers are free to choose to use Java or Scala for web development and to easily integrate with existing Java programs. The Play framework is a boon for Java developers in today's XML (annotation) Horizontal Java EE development area. In the agreement better than the configuration of the guiding ideology, finally can and cumbersome configuration file say goodbye!

All in all, the play framework is a fast, easy, and fun lightweight Java (Scala) Web development framework that, although not as popular as the famous SSH, has many pleasing features. So, the Play framework is simply a modern magic that is easy to understand and that has wood!

Installation of the 2.Play framework

Before installing the play framework, be sure to install the JDK first, but you can see that the estimates are all Java programmers, and this problem may not exist.

"1" Download installation package: Https://www.playframework.com/download

Click Download (only 1M), then unzip it; I unzipped it in I:\Play\activator.

"2" Configuration environment variables

This is the same as Java, edit the PATH environment variable, put that directory just add in it.

"3" Installation is complete, open cmd test it:

Activator help

If the help message pops up, it means the installation was successful! It's really easy to understand!

3. IDE?

In fact, here, the framework has been configured, you can already develop a Web application. But I still recommend a famous Java Ide:http://www.jetbrains.com/idea/intellj idea, that's it! You see in the introduction video of the play Framework website is it, the function is very powerful.

"1" official Website Download development tools: http://www.jetbrains.com/idea/

"2" Installation

"3" Purchase (PO) Buy (Jie) registration code

"4" Install Scala plugin: Http://confluence.jetbrains.com/display/IntelliJIDEA/Scala

For this IDE and related plug-in installation, the official website of the tutorial is very rich, is not the focus of this discussion, so the introduction here, if you have any questions, please contact me!

4. First Hello World program

According to international practice, let's write a Hello world! First switch to my working directory in cmd:

"1" New project

Activator new

For the first time, you may need to wait a few minutes, as it downloads the relevant resources and templates, and then quickly.

"2" Select template

Enter 5, select the Play-java template, enter HelloWorld as the project name, and a Java project is automatically generated.

"3" Enter HelloWorld project directory

CD HelloWorld

"4" Start the server

Activator run

When you start the server for the first time, you also need to wait for it to download updates.

"5" Open Browser, type: http://localhost:9000/

So you see the page above! How, is not very easy to understand it!?

"6" Modify the/helloworld/app/controllers/application.java file

In order to be able to display Hello World, we put your new application is ready. This sentence is changed to Hello world!

"7" Refresh Web page

Change success, good magic!

5. Next Notice

This is the end of this simple and understandable modern magic. The next main content is:

(1) Why modify Application.java will modify the page display, background code file How to affect the front-end?

(2) How does the URL address relate to the displayed page?

(3) How Web pages work

Look forward to: simple and understandable modern magic--play framework Raiders 2:controllor and routes

Easy-to-understand modern Magic--play Framework Guide 1

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.