Java Written test questions (V)

Source: Internet
Author: User
Tags mootools

One sentence a day: You may not stand out, but you must be different.

1. Tell me what Ajax technologies and frameworks you have used, and say that they differ
Ajax (Asynchronous JavaScript and XML, asynchronous JavaScript and XML) is one of the main development techniques for creating interactive Web applications, and there is also a great deal of Ajax-related mining in the Internet, this time summarizing the 11 commonly used:
(1) JQuery
jquery is a lightweight JavaScript library that is compatible with CSS3 and is compatible with a variety of browsers. jquery makes it easy for users to work with HTML document, events, animate, and provide Ajax interactivity to the site.
(2) MooTools
MooTools is a concise, modular, object-oriented JavaScript library. It can help you write more scalable and compatible JavaScript code faster and easier. MooTools is similar to Prototypejs, with almost the same syntax. But it offers more features than Prototypejs and is more powerful. For example, add animation effects, drag effects and so on.
(3) Prototypejs
Prototypejs is a very elegant JavaScript base class library written by Sam Stephenson, with a lot of extensions to JavaScript, designed to simplify the development of dynamic Web applications, Prototypejs very well supported Ajax, At home and abroad there are a number of libraries based on this kind of library implementation, but also do a good job.
(4) ASP-AJAX
ASP. NET AJAX is a complete development framework that is easy to combine with existing ASP., often implementing complex functions only need to drag a few controls in the page, without having to understand the deep working principle, the initial server-side programming of the ASP. NET AJAX Control The toolkit contains a large number of independent Ajax controls and an Ajax extension to the original ASP. NET server control, which is also very convenient to implement.
(5) Apache Wicket
Is a Java-oriented Web development framework similar to struts, webwork, and Typestry. It is characterized by an effective separation of HTML and code (which facilitates collaboration between programmers and artists), rule-based configuration (which reduces the use of configuration files such as XML), a lower learning curve (developed in a similar way to C/s), easier to debug (less error type and easier to locate).
(6) Dojo Tookit
Dojo is a powerful object-oriented JavaScript framework. Mainly consists of three major modules: Core, Dijit, DojoX. Core provides AJAX, events, packaging, css-based querying, animations, JSON and other related operations Api,dijit is a replaceable skin, template-based WebUI control Library, Dojox includes some innovation/ Novel Code and Controls: Dategrid, charts, offline applications, cross-browser vector drawing, and more.
(7) DWR (Direct Web Remoting)
Is a Java library that can help developers easily implement Java and client JavaScript on the server side and invoke each other.
(8) Spry Framework
Adobe Spry is an AJAX framework for web designers rather than developers, making it possible for designers to create rich experiences in an HTML page without having to understand complex Ajax techniques.

(9) YUI (Yahoo User Interface)
is an open source JavaScript function library developed by Yahoo, which adopts many techniques such as AJAX, DHTML and Dom, and Yui contains a variety of program tools, function libraries and web interface to develop interactive and rich website applications faster.
() GWT (Google Web Toolkit)
is an open-source Java development Framework that makes it easier for developers who don't use the second browser language to write AJAX applications like Google Maps and Gmail.
(one) ZK Framework
ZK is a set of open source, compatible XUL/HEML standards that use this framework, and you can create a rich Internet application (RIA) that supports Web2.0 without writing JavaScript code. The biggest benefit is that when designing an AJAX Web application, it's just as easy to do as designing a desktop application. ZK contains an AJAX-based, event-driven, highly interactive engine that also provides a rich, reusable set of XUL and HTML components, as well as an XML-based interface design language.
2. Tomcat's optimization experience
Remove the watch for Web. XML and edit the JSP into a servlet in advance. With surplus physical memory, increase the memory of the JVM used by Tomcat.
3. The difference between the get and post methods of HTTP requests
(1) Transfer data format
Get request, the requested data parameter is appended to the URL, in the? Separate URLs and transfer data, with & connections for multiple parameters. The URL is encoded in ASCII encoding instead of Unicode, meaning that all non-ASCII characters are encoded before being transmitted.
POST request: The POST request places the requested data in the package body of the HTTP request packet. So the transfer data for a GET request is exposed in the address bar, and post does not.
(2) Transfer data size
In the HTTP specification, there is no limit to the length of the URL and the size of the data being transmitted. However, in the actual development process, for get, the specific browser and server to the length of the URL is limited. Therefore, when you use a GET request, the transfer data is limited by the URL length.
In the case of post, it is theoretically not restricted because it is not a URL, but in practice the individual servers stipulate that the data size of the post submission is limited, and Apache and IIS have their own configuration.
(3) Security
The security of post is higher than get.
(4) The Get, POST, and SOAP protocols in HTTP are all running on HTTP.
4. The life cycle of the servlet?
A servlet is a well-defined lifetime definition that includes loading and instantiation, initialization, processing requests, and end of service. This lifetime is expressed by the Init, service, and destroy methods of the Javax.servlet.Servlet interface.
After the servlet is instantiated by the server, the container runs its Init method, the service method is run when the request arrives, the service method automatically dispatches the Doxxx method (Doget,dopost) corresponding to the request, etc. Use the Destroy method when the server decides to destroy the instance.
Basic architecture of 5.Servlet

public class ServletName extend HttpServlet{    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{    }    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{    }}

6. Differences between forward () and redirect () in Servlets
The former is only the control in the container of the steering, in the client browser address bar will not show the post-turn address, the latter is a full jump, the browser will get the address of the jump, and resend the request link, so in the browser's address bar can see the link address after the jump. So the former is more efficient, when the former can satisfy the need, try to use the forward method, and this also helps to hide the actual link. In some cases, you need to jump to a resource on a different server than the Xu Rong Sendredirect () method.
7. Under what circumstances are doget () and Dopost () called?
The method property in the from tag in the JSP page is called doget () when it is get, and the post is called Dopost ().
8. The main method of the Request object:
SetAttribute (String name, Object obj): Sets the parameter value of the request named name;
GetAttribute (String name): Returns the property value specified by name;
Getattributenames (): Returns a collection of the names of all the properties of the request object, and the result is an instance of the enumeration;
GetCookies (): Returns all the cookie objects of the client, resulting in an array of cookies;
Getcharacterencoding (): Returns the character encoding in the request;
Getcontentlength (): Returns the length of the request body;
GetHeader (String name): Gets the file header information defined by the HTTP protocol;
Getheaders (String name): Returns all values of the request header for the specified name, which results in an enumeration instance;
Getheadernames (): Returns the name of all request headers, and the result is an enumeration instance;
getInputStream (): Returns the requested input stream for obtaining the data in the request;
GetMethod (): Obtains the method that the client transmits the data to the server;
GetParameter (String name): Gets the parameter value specified by the client to the server driven by name;
Getparameternames (): Gets the name of all parameters that the client sends to the server side, and the result is an enumeration instance;
Getparametervalues (String name): Gets all the values of the parameter specified by name;
Getprotocol (): Obtain agreement name;
GetQueryString (): Gets the query string;
Getrequesturi (): Gets the client address of the sending request string;
GETREMOTEADDR (): Obtain the IP address of the client;
Getremotehost (): Get the name of the client;
GetSession ([Boolean create]): Returns and requests the relevant session;
getServerName (): Gets the name of the server;
Getservletparh (): Gets the path of the script file requested by the client;
Getserverport (): Gets the port number of the server;
RemoveAttribute (String name): Deletes a property in the request.
9. What are the built-in objects for JSP?
Request: The client requested that the request contain parameters from the Get/post request;
Response: The response of the Web page back to the client;
PageContext: page Property management;
Session: Conversation period related to the request;
Application:servlet what is being done;
Out: The output used to transmit the response;
Config:servlet architecture components;
page:jsp Web page itself;
Exception: An uncaught exception for Web page errors.
10. How to transfer objects between pages
Request,session,application,cookie and so on.
what are the similarities and differences between JSP and servlet?
JSP is the extension of servlet technology, is essentially a simple way of servlet, JSP more emphasis on the application of the appearance of expression, compiled is "class servlet." The main difference between Servlets and JSPs is that the application logic of the servlet is in the Java file and is completely detached from the HTML in the presentation layer, whereas the JSP case is that Java and HTML can be combined into a file with a. jsp extension. JSPs focus on Views, and Servlets are used primarily for control logic.

Java Written test questions (V)

Related Article

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.