Create, run, and debug a play Framework Application

Source: Internet
Author: User

Play! (Windows ):

Download the file http://www.playframework.org/download the latest installation package, play-1.2.3.zip

Decompress the package to the local folder, for example, D: \ play \

Set the environment variable path to the installation directory, open the window command line: Enter play, and the play will be output! Indicates that the installation is successful.


Play! Create a project:

Open the window command line and enter the directory of the project to be saved. Play new MyApp requires that the project description be entered. after entering the description, the project is created. The specific directory is as follows:


APP: controller, model, and view

Conf: including application. conf, dependencies. yml (dependent on modules configuration), routes, and messages Message configuration file

Lib: jar package

Public: Where JS, CSS, and images are stored.

Test: The test code.


The overall structure is clear.


Play! Project run test:


You have created a new project and run it easily. Enter play run MyApp in the command line. If it is already in the project directory, you do not need to add the project name.

You can see the server startup information. After the server is started successfully, it can be opened in the browser, http: // localhost: 9000


Modify APP/controllers/application. Java

 

Java code
  1. Public class application extends controller {
  2. Public static void index (){
  3. Render ()
  4. }
  5. }

 

Modify the code in the index method to see the effect in the browser.


Test Run Mode: Play test MyApp


Reference: http://www.playframework.org/documentation/1.2.3/overview


Use ide tools:


Directly run the command line to enter the project directory and enter play javassify to generate the Eclipse project file. Then, import the project in eclipse,


Run the project in Eclipse: Right-click Eclipse/MyApp. Launch and run it.

The other two

Test MyApp. Launch is run in Test Mode

Connect JPDA to MyApp. Launch is in debug mode. (You Need To Run MyApp. Launch first, and then run this operation to debug mode)


Others can refer to http://www.playframework.org/documentation/1.2.3/ide


Play! You can go to the official document http://www.playframework.org/documentation/1.2.3/homefor further study. For more information, see play! Examples provided in the installation directory (installation directory: \ play \ samples-and-tests)

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.