Key points of javaweb final review

insert image description here
2022.12.12 javaweb review focus
10 multiple choice questions 10 fill in the blank questions 10 judgment 2-3 short answer questions 2 program questions (15 points each)

1.HTML, Javascript, div+css?
Detailed explanation

HTML

HTML (Hyper Text Mark-up Language) is a hypertext markup language, which is a markup language used to describe web pages. In simple terms, we can compare HTML to a featherless bird, but the basic skeleton structure of this bird is the complete
CSS

CSS: cascading style sheet, simply put, css is equivalent to putting beautiful feathers on this bird, making it look very beautiful

JavaScript

JavaScript is a very important presence in our front end. Simply put, JavaScript is what allows the web pages we make to move. Can provide users with a better experience. Just like this little bird, wouldn't it be more perfect if it had some behaviors?

DIV+CSS is a WEB design standard, which is a layout method for web pages. Different from the traditional way of positioning through table layout, it can realize the separation of web page content and performance

2. servlet life cycle?
The whole process from servlet appearance to demise (destruction)
Instantiation: The Servlet container creates an instance of the Servlet
Initialization: The container calls the init() method
Request processing: If the Servlet is requested, the container calls the service() method
Service termination: Called before destroying the instance destroy() method

3. Leap year? int year=2022
if (year%4000||year%100!=0&&year%40)

4. How to get username and password in servlet?
username = req.getParameter(“username”); password = req.getParameter(“password”);

5. How to deal with garbled characters (POST, GET)
request.setCharacterEncoding("utf-8");
Modify server.xml: URIEncoding="utf-8"
By default, the encoding method used by tomcat: iso8859-1

4.5.
username=request.getParameter(“uername”);
username=new String(username.getBytes(“iso-8859-1”),“utf-8”);

6. How to configure UserServlet in web.xml?

name
package


name
virtual path

7. The page command introduces the java package, through the attribute?
<%@page import=""%>

8. Tomcat publishes web projects, the default path?
Webapps

9. Project name: website a.jsp address bar?
http://localhost:8080/website/a.jsp

10. What are the values ​​of float in css?
left (left floating), none (not floating), right (right floating), inherit (inherit parent element floating)

11. Add value to request object?
request.setAttribute();
(key, value)

12. When is ResultSet used?
Query data

13. Statement function?
It is used to send the SQL statement to be executed to the database on the basis of the established database connection

14. What method is called to perform additions, deletions, and modifications?
executeUpdate()

15. Call the query
executeQuery()

16. Loop to read the data in the result set
rs.next()

17. Two ways to obtain data?
.getString("age");
.getString(1); Subscript

18. Spring framework?
Spring is a J2EE application framework, a lightweight IoC and AOP container framework

19. What are the advantages of the spring framework?
Simple, testable and loosely coupled...

It has the characteristics of simplicity, testability and loose coupling. From this perspective, Spring can be used not only for server-side development, but also for the development of any Java application. Summary of the advantages of the Spring framework: 1>, non-intrusive design Spring
is A non-invasive framework that minimizes application code's dependence on the framework.
2> Convenient decoupling and simplified development Spring is a big factory, which can hand over the creation of all objects and the maintenance of dependencies to the Spring container management, which greatly reduces the coupling between components.
3>, Support AOP Spring provides support for AOP, which allows some common tasks, such as security, transaction, log, etc. to be processed in a centralized manner, thereby improving the reusability of the program.
4>. Support declarative transaction processing.
Transaction management can be completed only through configuration, without manual programming.

5>, convenient program testing

Spring provides support for Junit4, which can easily test Spring programs through annotations.

6>, easy to integrate various excellent frameworks

Spring does not exclude various excellent open source frameworks, and it provides direct support for various excellent frameworks (such as: Struts, Hibernate, MyBatis, Quartz, etc.).

7>, reduce the difficulty of using Java EE API

Spring provides encapsulation for some APIs that are very difficult to use in Java EE development (such as: JDBC, JavaMail, etc.), which greatly reduces the difficulty of applying these APIs.

20. What is Ioc?
Express it in your own words or with examples

(1) ioc is called inversion of control, which is an object-oriented design method.

(2) Hand over the creation of objects and the calling process between objects to spring management.

(3) Purpose: In order to reduce the degree of coupling

21. What is DI?
Dependency Injection

Is an html language, the tag defines a definition list (definition list), used to combine (items in the definition list) and (items in the description list)

22. What is AOP?
Aspect-oriented programming, explanation can use examples

Aspect-oriented programming, a technology that achieves unified maintenance of program functions through pre-compilation and dynamic agents during runtime. AOP is the continuation of OOP, a hot spot in software development, an important content in the Spring framework, and a derivative paradigm of functional programming. AOP can be used to isolate various parts of business logic, thereby reducing the coupling degree between various parts of business logic, improving the reusability of programs, and improving the efficiency of development at the same time.

Guess you like

Origin blog.csdn.net/weixin_57780589/article/details/129315013