[Original content]
Q &
1,
JSP
The Web
For the technology of developing dynamic interactive web pages in applications, describe JSP
Advantages and disadvantages of technology?JSP technology has all the features of Java technology, which are simple and easy to use, fully object-oriented, platform-independent, secure and reliable, and Internet-oriented. Technical advantages of JSP: 1. One-time writing and running everywhere. 2. multi-platform support of the system. 3. Powerful scalability. 4. diversified and powerful development tool support. Technical weakness of JSP: 1. The complexity of the product is greatly increased because of the cross-platform functionality and extreme scalability. 2. the Java running speed is completed by using the Class Object resident memory. Therefore, the computer system must have enough memory to ensure program running.
2,
Brief Introduction to JSP
.When the JSP page is called by the Java server for the first time, it is automatically compiled into a servlet through the JSP engine, and then executed. The compiled servlet will be executed each time it is called. Display the execution result on the client.
3,
In JSP
<JSP: Include>
Tags can contain two types of files: dynamic files and static files. What are the similarities and differences between the two types of files during parsing and execution on the server.<JSP: Include> the tag can contain dynamic and static files, but the results of these two types of files are different. If the file is only a static file, this inclusion only adds the content of the contained file to the JSP file. Such contained files are not executed by the JSP compiler. Conversely, if the contained file is a dynamic file, the file will be executed by the JSP compiler.
4,
In the Web
What are the common page redirection technologies on the page? In Servlet
In, how do we implement page forwarding?
5,
Please write out JDBC
Technology connection SQL Server
Connection object
) And create a statement set object (statement
) Java
Code.
Connection connection; Statement statement; string sourceurl = "JDBC: Microsoft: sqlserver: // 127.0.0.1: 1433; databasename = Your Database Name"; string username = your database username; string Password = your database access password; Public databaseconnection () {try {class. forname ("com. microsoft. JDBC. sqlserver. sqlserverdriver "); connection = drivermanager. getconnection (sourceurl, username, password); Statement = connection. createstatement ();} catch (sqlexception sqle) {system. err. println ("error creating connection");} catch (classnotfoundexception cnfe) {system. err. println (cnfe. tostring ());}} |
6,
Compare and briefly describe the use of JSP + JavaBean
Development and use of JSP + servlet + JavaBean
What are the differences between development modes? What are the advantages and disadvantages?1. When a project is developed in JSP + JavaBean mode, the JSP page responds to the request independently and returns the result to the client after processing. The Javabean is responsible for processing the business logic. This mode is simple, fast, and efficient. However, a large amount of Java code will be embedded in JSP pages. When the business logic to be processed is complex, the page will become very complex. It is also difficult to maintain. 2. When Using JSP + servlet + JavaBean mode to develop a project, the system structure is very clear and complies with the MVC development model. JSP is responsible for controlling the display of client information; Javabean is responsible for processing specific business logic; servlet acts as a controller to control the forwarding of program logic. This facilitates System Development and later maintenance. The disadvantage is that servlet compilation is more difficult than JSP, And the configuration is also more complex.
7,
JavaBean
What are the features?1. code reuse; 2. Easy to maintain, easy to use, and easy to write; 3. It can work on any platform supporting Java without re-compilation; 4. transmission can be performed within, within, or between networks; 5. transmission can be performed in other components mode.
8,
Briefly describe JavaBean
And EJB
?The concepts of the JavaBean Component and the enterprise-level EJB component are completely different. As the core technology of J2EE, EJB provides a model for developing server-side application components. This model is used to create portable and distributed enterprise application servers or components. EJB is a powerful component model used to create distributed, server-side, and Java-based enterprise application components.
9,
Briefly describe Servlet
LifecycleServlet lifecycle is divided into the following stages: 1. Loading servlet2, creating a servlet instance 3. Calling the servlet Init () method 4. Service 5. Destruction in the above stages, external services are the most important stage, and the service () method is our most concerned method. Because it is a method for processing services.
10,
When using Servlet
, Dopost
Method and doget
What are the differences between methods?1. The dogetget call is used to obtain server information and return it to the client as a response. Get is generally used to directly access the servlet URL through a Web browser or through HTML or JSP. The get call shows the data that is being sent to the servlet in the URL, which brings some problems in system security. To use doget, you must specify the call type as get in the form of the client. 2. dopost is used to send data from its client to the server. The advantage of using it is that it can hide any data sent to the server. Post is suitable for sending large amounts of data.
11,
In JSP
Data sharing can be divided into two methods. One is to share data between different pages of the same user, and the other is to share data between different users. Please answer the question in which of the above two methods can be implemented respectively?For a session of the same user, to share data between different pages, you can have the following options: 1. Save data in the session; 2. Use cookies; 3. submit data to the next page through an implicit form. 4. Use the servletcontext object. 5. Use the application object. 6. share data with different users through the file system or database, the common method is: 1. Through the servletcontext object 2, through the Application Object 3, through the file system or the database