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...