How to convert a Simple CMS background management system example to a version in different background languages such as Java and PHP

Source: Internet
Author: User

If you are waiting for a ride, we will not continue the development process today. Let's talk about background language issues that are commonly concerned.

Learning ext JS, I have always stressed that the central idea of learning is"The interface and data are separated". As long as you master this idea and have a deep understanding of the operation process of ext JS, you will not be troubled by the background language usage. It can be said that as long as the idea is clear, it is easy to migrate an ext JS project to different background language platforms. The following is a simple example.

If you put down the language burden and insist on reading the article in this example, you will feel that the combination of the client script file and the background language file has only one, that is, the homepage index. cshtml. If all the scripts in this file are extracted, basically ext JS has nothing to do with the development language platform. Copy the scripts directory to any language platform project, can be used directly. The address is basically changed. If Ext. Direct is used, this is more thorough, and there is basically no need to make any changes, and there is a corresponding method for the background language. If you know this, it's easy to do.

For example, if you want to change this example to a Java version, if the Java architecture does not support authentication, split the homepage into two files, one dedicated for login, one is the page to jump to after login. This method is estimated to be familiar with web development.

In ext JS, there are three main data submission methods:

1. form-based submission. Although Ajax is also used for submission, there is no difference between background processing and basic form-based submission. Therefore, the background data processing method is, no difficulty, you know! Don't you understand? This ...... Make up HTML knowledge. The best example is the submission of the logon window. You can try to practice in a language you are familiar.

2. submit in Ajax format. The example here is the password reset during user login. Although the data format is not fixed, the submit parameter is defined by yourself or the project, the data processing method in the background is not much different from the data submitted in the form.

3. Store Data Synchronization submission method. As long as writer is defined and the same data submission method is used, the background data processing method is basically the same. For example, for adding, editing, and deleting operations in user management, the submitted data must be extracted from the data keyword, then, you need to convert the submitted data to a JSON Array Using the parse method of the json object on the server side, and then extract the specific data object for processing. For Java processing, see section 1.2.6. In other languages, you can find the corresponding JSON library for processing.

In ext JS, the data return format is also basically fixed. In the example, the current return format is two:

1. form error message:

{

Success: true or false,

Errors :{

Field1: "error message ",

Field2: "error message ",

...

}

}

2. Other data

{

Success: true or false,

Total: total data,

Data: [...],

MSG: "error message"

}

 

In the example, both store synchronization and Ajax data submission use 2nd data return formats, which are basically common.

After understanding the ext JS data submission format and return format, you will know how to extract and return data. As long as the data is returned in a correct format, ext JS can run normally without any background language impact. As for what languages and databases are used in the background, there is no problem. These are the technologies that developers have mastered, and the rest is to return data based on the format. Therefore, it is not difficult to modify this example.

For example, to display user data, no matter what structure the data table is, after you extract the data from the database, you can organize the data to be returned Based on Format 2. You said you don't know how to extract data from the database? This ...... I cannot teach this either.

To add a user, extract the data according to the submitted format, and then add the data to the database by adding the data in your database. 2, return the successfully added or failed information to the client. The basic steps for editing and deleting are the same.

As for permission control, various languages have their own methods. The simplest is to verify the headers of each operation method. If the verification finds that the permission does not meet the permission requirements, then, a success value is returned Based on Data Return Format 2, and the MSG information is "You are not authorized to access.

After the data processing method is clear, the rest is to make the data submission address of each ext JS operation correspond to the method in the server. This is based on web development and is not too difficult.

The above roughly introduces how to change this example to different language versions. If you have any questions, please leave a message to me and discuss the development methods of different languages. If you are interested in changing this example to a different language version, you are welcome to contact the author to change this example to an example of a different language version for your learning.

 

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.