Java face test-web article 15 __HTML5

Source: Internet
Author: User
Tags html form
Java face test-web 15

148,ajax have some and disadvantages.

Advantages:

1, the biggest point is the page does not refresh, the user experience is very good.

2, the use of asynchronous way to communicate with the server, with more rapid response capabilities.

3, can put some of the previous server burden to the client, the use of idle client capacity to deal with, reduce the burden of server and bandwidth, save space and broadband rental costs. and reduce the burden on the server, the principle of Ajax is "on-demand data", can minimize redundant requests, and respond to the burden on the server.

4, based on standardized and widely supported technology, do not need to download plug-ins or small programs.

Disadvantages:

1, Ajax does not support the browser back button.

2. Security issues Ajax exposes the details of interacting with the server.

3, the search engine support is weaker.

4, the failure of the program's abnormal mechanism.

5, not easy to debug.


What is the difference between a 149,ajax application and a traditional Web application?

In traditional JavaScript programming, if you want information on a server-side database or file, or send client information to the server, you need to create an HTML form and then get or post data to the server side. Users need to click the "Submit" button to send or receive data information, and then wait for the server to respond to the request, the page reload.

Because the server returns a new page each time, traditional Web applications can be slow and user interaction unfriendly.

Using AJAX technology, you can enable JavaScript to interact directly with the server through XMLHttpRequest objects.

With HTTP request, a Web page can send a request to a Web server and accept the information returned by the Web server (without reloading the page), the same page is displayed to the user, the user feels the page refreshed, Nor do I see a request for sending and receiving a response from the JavaScript background, which is a great experience.


150,ajax the implementation of the process is what.

(1) Create a XMLHttpRequest object, which is to create an asynchronous invocation object.

(2) Create a new HTTP request and specify the method, URL, and authentication information for the HTTP request.

(3) Set up functions that respond to changes in the status of HTTP requests.

(4) Send HTTP request.

(5) Gets the data returned by the asynchronous call.

(6) Local refreshes are implemented using JavaScript and DOM.

Specific point:

1, create the Xnlhttprequest object

(without regard to IE) XMLHttpRequest request = new XMLHttpRequest ();

2, create a new HTTP request

Xmlhttprequest.open (Method,url,flag,name,password);

3, set a function to respond to changes in HTTP requests

Xmlhttprequest.onreadystatechange=getdata;

function GetData () {

if (xmlhttprequest.readystate==4) {

Get Data

}

}

4, Send HTTP request

Xmlhttprequest.send (data);

5, gets the object returned by the asynchronous call

, function (data) {

After an asynchronous commit, the interaction succeeds, and the returned data is the object returned by the asynchronous call, which is a string type

}

6, using JS, Dom to achieve local refresh

Mydiv.innerhtml= ' This is the refreshed data '


151, simply say the three paradigms of the database.

First paradigm: Every field in a database table is indivisible

Second paradigm: Non-primary attributes in database tables depend only on primary keys

Third paradigm: There is no dependency on the transitive function of the key by non-primary attribute


What the 152,java set frame is. Name some of the advantages of the collection framework.

There are collections in each programming language, and the original Java version contains several collection classes: vectors, Stack, Hashtable, and array.

With the extensive use of the set, Java1.2 proposes a set framework encompassing all the set interfaces, implementations, and algorithms. Java has been going on for a long time, using generics and concurrent collection classes while ensuring thread safety. It is also included in Java and the contract, blocking the interface and their implementation.

Some of the advantages of the collection framework are as follows:

(1) Use core collection classes to reduce development costs rather than implementing our own collection classes.

(2) with the use of rigorously tested collection framework classes, code quality can be improved.

(3) The cost of code maintenance can be reduced by using the collection classes that are included with the JDK.

(4) reusability and operability.


153,java the base interface of the collection framework.

Collection is the root interface of the collection hierarchy. A collection represents a set of objects, which are the elements of that object. The Java platform does not provide any direct implementation of this interface.

A set is a collection that cannot contain duplicate elements. This interface models mathematical set abstraction, which is used to represent a collection, just like a deck of cards.

A list is an ordered collection that can contain duplicate elements. You can access any element through its index. The list is more like an array of length dynamic transformations.

A map is an object that maps a key to value. A map cannot contain duplicate keys: Each key can map at most one value.

Some of the other interfaces are queue, dequeue, SortedSet, SortedMap, and Listiterator.


154, what are the advantages of generics in the set frame?

Java1.5 introduces generics, and all the collection interfaces and implementations use it heavily. Generics allow us to provide an object type that can be accommodated for the collection.

So if you add any other type of element, it will be wrong in the compile times. This avoids classcastexception at run time, because you will get an error message at compile time.

Generics also make the code neat, and we don't need to use explicit conversions and instanceof operators. It also benefits the runtime because byte code directives that do not produce type checks are generated.


The difference between 155,enumeration and iterator interfaces.

Enumeration is twice times faster than iterator and uses less memory. Enumeration is very basic and meets the needs of the foundation.

However, iterator is more secure than enumeration, because when a collection is being traversed, it prevents other threads from modifying the collection.

The iterator replaces the enumeration in the Java collection framework. Iterators allow the caller to remove elements from the collection, and enumeration cannot do so. To make the function clearer, the iterator method name has been improved.


What is the difference between 156,iterater and Listiterator.

1, we can use iterator to traverse the set and list collection, while Listiterator can only traverse the list.

2,iterator can only be traversed forward, while Listiterator can be traversed in two directions.

3,listiterator inherits from the iterator interface, and then adds some extra functionality, such as adding an element, replacing an element, and getting the index position of the front or back elements.


157, how do we sort a group of objects.

If we need to sort an array of objects, we can use the Arrays.sort () method. If we need to sort an object list, we can use the Collection.sort () method.

Two classes have overloaded method sort () for natural sorting (using comparable) or standards-based sorting (using comparator).

Collections internally uses array sorting methods, all of which have the same performance, except that collections takes the time to convert the list to an array.


158, what is the best practice associated with the Java collection framework?

1, select the correct collection type as needed. For example, if the size is specified, we will choose array instead of ArrayList. If we want to traverse a map based on the insertion order, we need to use TreeMap. If we don't want to repeat, we should use set.

2, some collection classes allow the initial capacity to be specified, so if we can estimate the number of storage elements, we could use it to avoid a hash or resize.

3, based on interface programming, rather than on implementation programming, it allows us to easily change implementations later.

4, always use type-safe generics to avoid classcastexception at run time.

5, using the immutable class provided by JDK as the key of the map, you can avoid hashcode () and Equals ().

6, use the Collections tool class whenever possible, or get a read-only, synchronized, or empty collection, rather than writing your own implementation. It will provide code reusability, which has better stability and maintainability.


159, what is business. ,

Transactions are the basic unit of recovery and concurrency control

Four basic characteristics of a transaction

Atomicity, consistency, isolation, persistence

Atomicity is about the same as consistency, which means either total success or failure.

Consistency is saying, from one consistency state to another

Isolation is the process of saying that a transaction executes

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.