Java interview Questions--no interview will regret

Source: Internet
Author: User
Tags aop rollback access database
1. Please describe the project you are doing:

XXX system is what, the main purpose is XXX, the entire system contains what function modules, and then said that contains which modules, what modules they have done. 2. Talk about your understanding of MVC in conjunction with the project

MVC is the abbreviation of Model-view-controler. Which is the model-view-controller. MVC is a design pattern that is forced to separate the input, processing, and output of an application. The models, views, and controllers in MVC assume different tasks.
Views: Views are the interfaces that users see and interact with. The view displays the relevant data to the user and accepts the user's input. The view does not handle any business logic.
Model: The model represents business data and business processing. Equivalent to JavaBean. A model can provide data for multiple views. This increases the reusability of the application.
Controller: When the user clicks the Submit button in the Web page, the controller receives the request and invokes the appropriate model to process the request. The corresponding view is then invoked according to the result of the processing to display the processing structure.
The process of MVC: first the controller receives the user's request, invokes the corresponding model for business processing, and returns the data to the controller. The controller invokes the corresponding view to display the processing structure. and renders it to the user through a view. If you want to correspond to MVC in a project, the Jsp,controler in the view corresponding project corresponds to the action,model corresponding to the SERVICE+DAO layer's business logic and persistence layer operations. 3. Why to use SSH in the project (advantages of the three major frameworks)

1. Use struts because struts is based on the MVC pattern, it is good to layered the application, so that developers pay more attention to the implementation of business logic, struts has a rich tag library, can greatly improve the development efficiency.
2. The use of Hibernate is because Hibernate provides an easy-to-use, efficient object-relational mapping framework for Java applications. Hibernate is a lightweight, persistent layer framework that is rich in functionality.
3. Spring is used because spring is based on the framework of the IOC (control reversal) and the AOP framework multi-tier Java System 4. Pick a feature that you do. Application principle of SSH framework

1. In the presentation layer, first implement the interactive interface through the JSP page, responsible for the transfer requests (request) and receive response (response), and then struts according to the configuration file (struts). XML) to delegate the request received by Actionservlet to the action processing of the response.
2. In the business layer, the spring IOC container that manages the service components is responsible for providing the business model component and the component's collaboration Object Data Processing (DAO) component with the business logic, and provides transaction processing, buffer pools, and other container components to improve system performance and ensure data integrity.
3. In the persistence layer, it relies on hibernate mapping and database interaction, processing the data requested by the DAO component, and returning the processing results.

Synthesis of the above overview; then we can do the information Release Management module in the above way to instantiate the description. 5.struts Working principle

——-According to the working principle of Struts
1. The client issues a request to the servlet container;
2. The request passes through the Strutsprepareandexecutefilter filter;
3. Filters and requests will access the underlying frame structure of the strut2. When the Web container starts, the STRUTS2 framework automatically loads the relevant parameters in the configuration file and converts them to the appropriate classes.
such as: ConfigurationManager, Actionmapper and Objectfactory.configurationmanager have some basic information about the configuration file, Actionmapper have the configuration information for the action. All objects (action,results,interceptors, etc.) in the request process are created by objectfactory. The filter will ask the Actionmapper class to find the action that is needed in the request.
4. If you find an action that needs to be invoked, the filter will hand over the processing of the request to Actionproxy. Actionproxy is the proxy object for the action. Actionproxy the action class that needs to be invoked by asking the framework's configuration file ConfigurationManager.
5.ActionProxy creates an instance of Actioninvocation. Actioninvocation under the Actionproxy layer, it represents the execution state of the action, or the execution step of the action it controls. It holds the action instance and all the Interceptor. The
6.ActionInvocation instance is invoked using a naming pattern, and when 1.ActionInvocation is initialized, according to the configuration, Loads all interceptor.2 associated with the action. Executes the interceptor when the action implementation is called by the Actioninvocation.invoke method. The call to the associated Interceptor (Interceptor) is involved before and after the action is invoked.
7. Once the action has been executed, Actioninvocation is responsible for finding the corresponding return result according to the configuration in Struts.xml.

———— – a popular saying ————
Send HTTP request
Web server (tomcat, WebLogic)
Execute Struts Core filter Strutsprepareandexecutefilter
Loads the configuration information in the struts configuration file, finds the corresponding action class, and instantiates
Perform various interceptor and action response methods
Find return result in configuration file
What are the pros and cons of forwarding to a specific page or other operation 6.struts?

———— – Advantages ————
1. Realize the MVC pattern, the structure is clear;
2. Rich struts of the tag library, good use can greatly improve the development efficiency
3. Global results and declarative exceptions;
4. Can use OGNL for parameter transfer
5. All kinds of convenient use of interceptors

———— – Disadvantages ————-
1. When you go to the presentation layer, you need to configure the results page; The page is more complicated;
2. Dependencies on the servlet are too strong
3.struts tags are slightly heavier than El expressions 7. Why Spring is used

Spring is a lightweight control reversal (IOC), facet-oriented (AOP), interface-oriented, transactional management, containment-promoting other frameworks, and a much lower degree of coupling between the other frameworks used in the system, scalability, simplicity, and ease of management. 8.spring How to act as a binder in the project

1. Using Spring's IOC (control inversion or dependency injection) in the project, the explicit definition of component interfaces (such as Userdao) allows developers to independently develop individual components and then assemble them based on dependencies between components (Useraction relies on UserService, UserService relies on Userdao) to run, and a good combination of struts (Action) and Hibernate (DAO implementation);
2.spring Transaction Management Hibernate the operation of the database to a transaction configuration 9. Describes how to use spring's transaction control in the system

Spring transactions include programming and declarative transactions. Declarative transaction management in the system is implemented with spring AOP, a read-only transaction and a ROLLBACK transaction (propagation behavior is required), and a transaction rollback operation occurs after an error. In a project, a transaction is made into a service layer through AOP, which enables a business logic operation to be controlled in one transaction if it includes several database operations. 10.Hibernate How it works and why you use it.

Principle:
1. Read and resolve configuration files
2. Read and parse mapping information, create Sessionfactory
3. Open session
4. Create transaction transaction
5. Persistent operation
6. Submission of services
7. Close session
8 off Sessionfactory

Why to use:
1. The encapsulation of JDBC Access database code greatly simplifies the cumbersome repetitive code of the data access layer.
2.Hibernate is a mainstream persistence framework based on JDBC and is an excellent ORM implementation. He simplifies the coding of the DAO layer to a large extent. 3.Hibernate uses a Java reflection mechanism rather than a bytecode enhancement program to achieve transparency.
4.Hibernate performance is very good, because he is a lightweight framework. The flexibility of mapping is excellent. He supports a variety of relational databases, from one-to-one to many-to-many relationships. 11.Hibernate optimization strategy used in the system

Hibernate the data cache includes two levels: A level of cache, at the session level, mainly object caching, with its ID as the key to save the object, during the life of the session exists; secondary caching, at the sessionfactory level, With object caching and query caching, query caching saves query results as keys to query conditions and exists during the life of Sessionfactory, by default, Hibernate only enables first-level caching 12. List the struts tags you use in development

property, iterator, if, date, form, a, URL, textfiled, textarea, select, Radio, CheckBoxList,
There are several ways to get data asynchronously hidden, param 13.Jquery. What's the difference.

1.load load Remote HTML file code and insert into DOM
2.get
3.post
4.ajax
5.getJSON
6.getScript requests to load and execute a JavaScript script through a Get method. 14, briefly describe the UML and the title of the book you are using rose often used in what situation, draw what picture.

UML is a unified modeling language for describing processes and functional requirements graphically in various phases of software development; IBM
Rational Rose is one of the many UML modeling tools in the requirements phase, often used in drawing examples, class diagrams, sequential graphs. 15. Describe the tool class that you exported, and indicate the maximum amount of data

POI (combining cell objects and background color applications)

Finally here also found some of Baidu Library interview questions: A lot of content, not one by one enumerated.
Portal: The most complete ssh frame face test

SSM Framework Interview Question: http://www.2cto.com/kf/201702/603919.html

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.