Question 1: Describe the differences between Post requests and Get requests and common application scenarios of the two
Both Post and Get requests are requests to obtain data from the server. Get requests are sent to the server through URLs, post is a request that puts the data to be submitted in the HTTP package body to submit data to the server. Theoretically, there is no length limit. For example, the URL length limit of IE browser is 2 kb. Post requests are more secure than Get requests. Because Get requests are implemented through URLs, the user name and password are easily exposed. Therefore, you must encrypt parameters when passing them. You can use Base64 () for encoding and decoding.
var b = new Base64();b.encode(pwd)b.decode(pwd)
The analysis of the two is in place in this article: complaints about GET and POST
Question 2: major differences between forward and redirect
Forward is the internal redirection of the server. After the program receives the request, it is redirected to another program, and the client does not need to know it. redirect means that a status header is sent to the user after the server receives the request, and the user requests again, in this case, there will be two communications between the client and the server. Because the request is made again, the information of the previous jsp is not retained.
Question 3: Write the execution results of the following javascript code
var a1 = 10; var a2 = 20;var r1 = "a1+a2=" + a1 + a2;var str1 = "I am a soft engineer";var r2 = str1.substring(9, 14);document.write(r1);document.write("%");document.write(r2);
Result: a1 + a2 = 1020% ft en
Question 4: Write the execution result of the following javascript code and explain the cause.
function Person(name) { this.name = name; this.move = function () { alert("Prepare move for person [" + this.name + "]") }; } Person.prototype.move = function () { alert("Ready move for person [" + this.name + "]") }; $(function () { var person = new Person("Jim"); person.move(); });
The execution result is: Prepare move for person [Jim]
I personally think the reason is that if the object comes with the move () method, it will not search for the prototype chain.