The two comparisons are as follows:
Jump type |
Number of client requests |
Service-side response times |
URL changes |
Off-site Jump |
Scope
|
Server Jump |
1 |
1 |
No |
Whether |
PageContext, request, session, application |
Client Jump |
2 |
2 |
Yes |
Yes |
Session, Application |
Number of requests and number of responses
Server-side jump: The client initiates a request, the service side receives the request, the result jumps to another page, as the result of this request is returned to the client
Client Jump: The client initiates a request, the server returns the result of the request, the result is a URL address, the client gets this URL, sends a request again, the service side responds to the final result to the client again
Therefore, for the server jump, the number of requests and responses are 1 times , for the client jump, the number of requests and responses are 2 times
Whether the URL changes
Service-side jump: Just service-side internal continuous forward, regardless of how many times forward, the client is not informed, the server will return the final results to the client, that is, to complete this request. The URL of the client has not changed.
Client Jump: The client initiates two requests and the URL changes (PS: The URL address of the two requests is the same unless the egg is busy)
Can I jump outside the station?
Service-side jump: Can not be off-site jump. Server-side requests can only be within the service, the result of the request response is constantly jumping, using the resources within the service. Cannot jump to other services.
Client jump: Yes. Jump directly to the URL of another service
Scope
To the four scopes of JSP, for scope see address http://www.cnblogs.com/mengzhen123/p/5968831.html
PageContext: Current Page
Request: Current Requests
Session: Current Callback
Application: the entire application. The narrow understanding of the application life cycle for service opening to closing
From the above we say the number of requests and the number of responses can be known, for the client jump, PageContext, request has changed. Because the client URL changed, PageContext changed, and the client sent two requests, and the request changed. So if you use a client jump, the shared data suggestions are stored in the session.
Why the service side has not changed, we realize the service-side jump method from Selvet forward it is not difficult to see, forward method call, with the request, response parameters, that no matter how many times the server forward, are using the same request , Response. Therefore, the PageContext and request scopes have not changed. The shared data is placed in the objects of both scopes and can still be taken.
Ps:selvet, Struts2, springmvc the way to achieve the request jump is different, but its essence is the same.
Server jump in Web development and client-side jump