First, the Applet
Definition of 1.Applet: applets are small applications written in the Java programming language, which can be contained in HTML (an application of the standard Universal Markup Language) page, in much the same way as the page contains images.
Java program can be divided into two categories, Java applets and general application, and application this kind of general program such as C + + function is similar, is a standalone executable application, like HotJava is a browser, and is developed using Java programs. The most common Java programs include applications and applets. Applications are separate programs, such as HotJava browser software written in the Java language. Applets are similar to applications, but they cannot be run alone, and applets can be run in a Java-enabled browser. Applets are primarily built into HTML pages and play a role in browsing.
2.Applet How to use:
The implementation of applet applets relies primarily on the applet classes in the Java.applet package. Unlike a typical application, an applet application must be embedded in an HTML page to be interpreted and executed, while an applet can get parameters from a Web page and interact with the Web page. An applet is a Java applet that is run by a Java-enabled web browser by using the applet's HTML file. It can also be run through the applerviewer of Java development tools. The applet program cannot be separated from the HTML file that uses it. The information about the applet in this HTML file should contain at least the following three points: 1) The bytecode file name (the compiled Java file, with a. class suffix) 2) The address of the bytecode files 3) The way the applet is displayed on the Web page. An HTML file that increases the content of an applet simply makes the page more animated, such as adding sounds, animations, and other appealing features that do not alter the HTML file's irrelevant elements. 3.Applet Operation Method: Applet program does not need the main method and construction method. After compiling, write an HTML file in the program directory that contains
<applet Code=xxxx.class height=100 width=300>
</applet>
Save As Xxxx.html
Can be opened in the browser
or run with the appletviewer provided by the JDK, using the same usage as the Javac usage
The command format is appletviewerxxxx.html. Second, Ajax1.ajax technology is what: Ajax is mainly to achieve the data between the page and the Web server asynchronous transmission. To give a simple example, do not use the Ajax page, when the user on the page to initiate the request, the entire page will be refreshed, the speed of the refresh depends on the server processing speed. In this process, the user must wait and be unable to perform other operations. That is, the way of synchronization. The client and the server pass a lot of data that is not needed. Low efficiency and poor user experience. With Ajax pages, you can implement a partial update of the page rather than an entire page update, and after the request is made, the user can also perform other actions on the page. That's how it's asynchronous. The client and the server only pass the required data, the efficiency is high, the user experience is good. How 2.Ajax works: Ajax works by adding a middle tier (Ajax engine) between the user and the server, making the user operation and the server response asynchronous. Not all user requests are submitted to the server, such as data validation and processing, to be done by the Ajax engine itself, only to determine the need to read new data from the server and then by the Ajax engine to submit the request to the server. Ajax has the core of JavaScript, XMLHttpRequest, Dom objects, through the XMLHttpRequest object to send an asynchronous request to the server, from the server to obtain data, and then use JavaScript to manipulate the DOM and update the page. One of the most critical steps is getting the request data from the server. 3.Ajax Action (unlike traditional web apps): Traditional Web application Interactions trigger an HTTP request from the user to the server, the server processes it and then returns a new HTHL page to the client, and each time the server processes the client-submitted request, the client can only wait. And even if it's just a small interaction, you just have to get a very simple data from the server to return a full HTML page, and the user has to waste time and bandwidth to reread the entire page each time. This practice wastes a lot of bandwidth, and the response time of the application depends on the response time of the server, because each application's interaction needs to send a request to the server. This causes the user interface to respond much more slowly than the local application.
Unlike this, an AJAX application can send and retrieve only the necessary data to the server, using SOAP or some other XML-based Web service interface, and using JavaScript on the client to process the response from the server. Because the amount of data exchanged between the server and the browser is much reduced, the result is that we can see applications that respond faster. At the same time, a lot of processing can be done on the client machine making the request, so the processing time of the Web server is also reduced. Advantages and disadvantages of 4.Ajax: (1) Ajax benefits
① Update data is not refreshed.
The biggest advantage of Ajax is the ability to communicate with the server to maintain data without refreshing the entire page. This enables the Web application to respond more quickly to user interactions and avoids sending information that is not changed on the network, reducing user latency and bringing a very good user experience.
② asynchronously communicates with the server.
Ajax uses asynchronous methods to communicate with the server, without interrupting the user's operations and having more rapid responsiveness. Optimize communication between browser and server, reduce unnecessary data transfer, time and reduce traffic on network.
③ front-end and back-end load balancing.
Ajax can pass on some of the previous server workloads to the client, take advantage of the client's idle ability to handle, reduce server and bandwidth burden, save space and broadband rental costs. and reduce the burden of the server, the principle of Ajax is "on-demand data", can minimize the redundancy request and response to the burden on the server, improve site performance.
④ is widely supported based on standards.
Ajax is based on standardized and widely supported technologies that do not require a browser plugin or applet to be downloaded, but require the client to allow JavaScript to be executed on the browser. With the maturation of Ajax, a number of libraries that simplify the use of Ajax have been introduced. Similarly, there is another assistive programming technique that provides alternative functionality for users who do not support JavaScript.
⑤ interface and application separation.
Ajax separates the interface in the Web from the application (or the separation of data and rendering), facilitates division of labor, reduces web application errors caused by non-technical changes to the page, improves efficiency, and is more applicable to today's publishing systems.
(2) Disadvantages of Ajax
①ajax killed the back and the history function, which is the destruction of the browser mechanism.
In the case of dynamically updating the page, the user cannot go back to the previous page state because the browser can only remember the static pages in the history. The difference between a fully read page and a page that has been dynamically modified is very subtle; The user will typically want to click the Back button to cancel their previous operation, but in an AJAX application this will not be possible.
The Back button is an important feature of a standard web site, but it does not work well with JS. This is a serious problem with Ajax, because users often want to be able to undo the previous operation by going backwards. So is there any way to do this question? The answer is yes, using Gmail know, Gmail under the Ajax technology to solve the problem, in Gmail can be back, but it does not change the mechanism of Ajax, it is only a relatively stupid but effective way, that is, the user click the Back button to access the history To reproduce the changes on the page by creating or using a hidden iframe. (for example, when a user clicks back in Google Maps, it searches in a hidden iframe and then reflects the search results on an AJAX element to restore the application state to its current state.) )
However, while this problem can be solved, the cost of development is very high and deviates from the rapid development required by the AJAX framework. This is a very serious problem caused by Ajax.
A related view is that using dynamic page updates makes it difficult for users to save a particular state to a collection. The solution for this problem has also occurred, with most of the URL fragment identifiers (often referred to as anchors, which are the parts of the # URL) to keep track of, allowing the user to return to the specified application state. (many browsers allow JavaScript to dynamically update the anchor point, which allows an AJAX application to update the anchor point while updating the display.) These solutions also address many of the arguments that do not support back buttons.
②ajax security issues.
Ajax technology provides users with a good user experience, but also brings new security threats to it enterprises, Ajax technology is like the enterprise data set up a direct channel. This allows developers to inadvertently expose more data and server logic than ever before. The logic of Ajax can be hidden from the client's security scanning technology, allowing hackers to create new attacks from remote servers. And Ajax also makes it difficult to avoid some known security weaknesses, such as cross-site footstep attacks, SQL injection attacks, and credentials-based security vulnerabilities.
③ is weaker for search engine support.
Support for search engines is weaker. If used improperly, Ajax can increase the flow of network data, thereby reducing the overall system performance.
④ the exception handling mechanism of the destruction program.
At least for now, these Ajax frameworks, like Ajax.dll,ajaxpro.dll, can disrupt the program's exception mechanism. On this issue, had encountered in the development process, but looked at the internet there is little relevant introduction. Later, an experiment was done to delete a piece of data using Ajax and the traditional form submission mode ... It has brought us a lot of difficulties in debugging.
⑤ violates the intent of URL and resource positioning.
For example, I give you a URL address, if you use Ajax technology, perhaps you see below the URL address and what I see under this URL is different. This is contrary to the original intention of resource positioning.
⑥ajax does not support mobile devices very well.
Some handheld devices (such as mobile phones, PDAs, etc.) are not yet well-supported Ajax, for example, when we open a website with Ajax technology on a mobile phone's browser, it is currently unsupported.
The ⑦ client is too fat, and too many client-side code causes development costs.
Write complex, error-prone, redundant code is more (layer contains JS file is the common problem of Ajax, coupled with many of the previous service-side code is now placed on the client), destroying the original standards of the Web.
Applets and Ajax