Java Web section

Source: Internet
Author: User

1. The difference between the get and post methods of HTTP requests

Get can be cached and saved by the browser, primarily for data acquisition.

Post cannot be cached and will not be saved by the browser for form submission

2. Explain what a servlet is

Servlets have a good life cycle, including loading and instantiation, initialization, processing requests, end of service

init, service, Destory represented by the Javax.servlet.Servlet interface

3, talk about the life cycle of the servlet.

Web server loading servlet----->servlet loading Start instantiation

Servlet initialization----->init () method

servlet Processing Request----->sevice () method (Doget\dopost)

Servlet Service End----->web container call Destory ()

4. The difference between forward () and redirect () in the Servlet API

Forward () is a forwarding, control in the container of the steering, the client address bar will not show the address after the turn

Redirect () is redirected, the browser will get the address after the jump

5, under what circumstances call Doget () and Dopost ()?

The method property of the from tag in the JSP page is called doget () when it is get, and is called when the Post is Dopost ()

6. The main method of request object

SetAttribute (), getattribute ()

7. What is the difference between request.getattribute () and Request.getparameter ()?

GetAttribute () is the data value in the object container, which is the value in the session

Getparamter () Gets the data for the form or URL redirection

8. What are the built-in objects of JSP? What are the roles? What are the different methods?

Request user-side requests

Response Web page back to the client's response

Session period associated with the request

What the application servlet is doing

PageContext Page Properties

Output used to transmit a response

Config Servlet's architectural parts

Page JSP pages themselves

Exception for the error page

9. Similarities and differences between JSP and servlet

JSP is the technical extension of the servlet, and the JSP is "class servlet" after compiling.

JSP focuses on Views, servlet focuses on control logic

10. What are the technologies that are implemented in each part of MVC? How is it implemented?

MVC is shorthand for Model-view-controller.

Model represents business logic (JAVABEAN,EJB)

View representation Views (JSP pages)

Controller representation Control (Servlet)

    

  

  

Java Web section

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.