servlet Course Examsservlet Course ExamsServlet Course Exam Scores:55 minTime limit:120 minutesThe answer to the exam has been successfully submitted! Please wait patiently for the results to be announcedservlet Course Exams:1 (12 points)
Talk a little bit about what a servlet you understand, and how the servlet works.
The servlet, the server Applet, is a program that runs on the server side. A Servlet object is actually a Java class.
When the browser communicates with the server, the browser makes a request to the server, which is resolved by the servlet container and sent to the corresponding Servlet object, responds to the request by the Servlet object, and returns the response to the browser.
ref:https://www.zhihu.com/question/21416727
2 (12 points)
Briefly talk about the difference between a cookie and a session, and in the development process, if you need a session hold, how to select the cookie and session
The difference between a cookie and a session is:
Storage location: The cookie is stored on the browser side, the session is stored on the server side;
Security: Cookies are passed in clear text and the session is safer than cookies
Life cycle: The cookie time is calculated from the start of the first visit; The session time is calculated from the date of the last visit; The cookie cannot be actively invalidated, and the session can;
Principle of Use: there is a limit to the number and size of cookies, but the recommended size is not too large.
If session retention is required, it is common to select the session, because security is high, the data is not passed in plaintext, only the session ID is passed, and there is no limit to the size.
ref:https://www.zhihu.com/question/19786827
Java Development Engineer (web direction)-02.Servlet technology-Final Exam