Find the solution to synchronize the front-end URL with the back-end in the MVC framework. mvcurl_PHP tutorial

Source: Internet
Author: User
Find the solution for synchronizing the front-end URL and the back-end URL in the MVC framework, mvcurl. Find the solution for synchronizing the front-end URL and the back-end URL in the MVC framework. The basic idea of mvcurl is to generate a complete URL character first with the URL tag, and fill in the dynamic parameters of the front-end with the adapter first, finally, find the solution for synchronizing the front-end URL and the back-end URL in the MVC framework.

Basic ideas:

Use the URL tag to generate complete URL characters. the dynamic parameters at the front end are filled with the adaption, and the dynamic parameters are replaced by regular matching.

This method can be applied in various MVC frameworks.

No nonsense. Upload the code.

var url = "{url app=xxxxn&act=yyy&id=[0]}";url = url.format({$id});

// String. format matches both [] () {} content mode if (! String. prototype. format) {String. prototype. format = function () {var args = arguments; var tag = ''; return this. replace (/(\ {| \ (| \ [) (\ d +) (\} | \) | \])/g, function (match, m0, m1, m2) {tag = m0 + m2; if (tag = '()' | tag = '{}' | tag = '[]') return typeof args [m1]! = 'Undefined '? Args [m1]: (m0 + m1 + m2 );});};}

The method of the String object is changed in the prototype method above, which can be modified as appropriate and changed to a common function for passing parameters.


How to prevent the address bar from directly hitting the url to access the background? the framework is spring mvc and the annotation method is used.

Put the logon information in the Session, and then judge, if (session = null) {jump to the login page }.

Net mvc front-end interaction with the background

Basically, ajax is used to submit data to the background or obtain data from the background.
 

Basic idea: first use the URL Tag to generate complete URL characters. the dynamic parameters of the front end are filled with the adapter first, and finally...

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.