61. The lifecycle Web container loads servlet, and the lifecycle begins. The initialization of the servlet is performed by calling the servlet's init () method. Different DO *** () methods are called depending on the request different by calling the service () method. End the service, the Web container calls the servlet's Destroy () method. 62. How do I actually servlet's single-thread mode <% @ page isthreadsafe = "false"%> 63, the page inter-page object delivery method Request, session, application, cookie, etc. What is the connection between? JSP is an extension of servlet technology, essentially a simple way of servlet, and emphasizes the application's appearance expression. After JSP compiles "class servlet". The most important point of Servlet and JSP is that the application logic of servlet is in the Java file and is completely separated from the HTML in the representation. The case of JSP is that Java and HTML can be combined into a file that extension .jsp. JSP focuses on views, servlet is mainly used to control logic. 65. Four session tracking technology session scope servletsJSP page Description Page No is a representative object and attribute related to a page. A page is represented by a compiled Java Servlet class (which can have any include instructions, but no include action). This includes both servlets and JSP pages that are compiled into a servlet, is an object and attribute that represents a request issued to a web client. A request may span multiple pages, involving multiple web components (because the relationship between Forward Directions and Include Actions) Session is object and attributes related to a user experience with a web client. A web session can often span multiple clients to request Application is the object and attribute that represents the entire web application.
This is essentially across the entire Web applications, including multiple pages, requests, and a global session scope 66, the main method of the Request object: setAttribute (String name, Object): set the name of the parameter values getAttribute request the name of ( String name): Returns GetAttributeNames (): Returns the name collection of all attributes specified by Name, the result is an instance of an enumeration getCookies (): Returns all cookie objects of the client, the result is a cookie array getCharacterencoding () : Returns the character encoding method in the request getContentLength (): Returns the length of the requested body (String Name): Get the file header information of the HTTP protocol definition GetHeaders (String Name): Returns all values of the request header of the specified name, the result is An instance of an enumeration getHeadernames (): Returns the name of the Request Header, the result is an instance of an enumeration GetInputStream (): Returns the requested input stream for obtaining the data in the request (): obtain the client to the server Method for transmitting data getParameter (String Name): Getting a client to send to the server-side parameter value getParameterNames (): Get the name of all parameters to the server to the server, the result is an enumerated instance getParameterValues (String Name : Get all values with Name specified parameters getProtocol (): Get the client to transfer data to the server to get QueryString (): get the query string getRequesturi (): Get the client address of the request string GetRemoteaddr (): Get the client's IP address getRemotehost (): Get the client's name GetSession ([Boolean Create]): Return and Request related sessiongetServerName (): Get the server's name GetServletPath (): Get the path to the script file requested by the client GetServerPort (): Get the port number of the server Removeattribute (String Name): Delete a property 67, J2EE is a technology or a platform or a framework? J2EE itself is a standard, a standard platform provided for the development of a distributed application. J2EE is also a framework, including JDBC, JNDI, RMI, JMS, EJB, JTA and other technologies. 68. We often encounter some coded characters in the web application development process, such as ISO8859-1, how to output a certain coded string? Public string translate (string str) {string tempstr = ""; try {tempstr = new string (Str.GetBytes ("ISO-8859-1"), "GBK"); Tempstr = Tempstr.trim ();} catch Exception E) {System.err.Println (E.GetMessage ());} Return Tempstr;} 69, a brief description logic operation (&, ^) and conditional operation (&&&, ||) distinguish.
The difference between the two points: a. Conditional operation can only be operated by Boolean, but logic operations can not only manipulate Boolean, but also operate value B. Logic operations do not generate short circuit 70, how many forms of XML document definitions? What is the essence difference between them? What kind of way to parse XML documents? A: Two forms of DTD Schema, B: Nature difference: Schema itself is XML, can be parsed by XML parser (this is also the fundamental purpose of developing SCHEMA from DTD), C: There are DOMs, SAX, Stax, etc. DOM: processing It is very powerful in large files. This problem is caused by the tree structure of the DOM. This structure is more memory, and the DOM must load the entire document into memory before parsing the file, suitable for the random access of XML SAX: not now in Dom, SAX is Event drive type XML parsing method. It sequentially reads the XML file, and does not need to load all files all. When encountered at the beginning of the file, the end of the document, or the label is ended, it triggers an event, the user handles the XML file by writing processing code in its callback event, suitable for the order of XML, Streaming API For XML (Stax) 71, briefly describe Synchronized and java.util.concurrent.locks.lock? The main same point: Lock can complete all the features implemented by Synchronized, and there is more accurate thread semantics and better performance than synchronized. Synchronized will automatically release the lock, and LOCK must request the programmer manually to release and must be released in the finally clause. 72, EJB role and three objects A complete EJB-based distributed computing structure consists of six roles, which can be provided by different developers, and each role works must follow the EJB provided by SUN. Specification to ensure compatibility between each other. These six characters are EJB component developers, Application ASSEMBLERs, deployers, EJB server providers, EJB container providers (EJB container providers, System Administrator's three objects are Remote (local) interface, home (localhome) interface, Bean class 73, EJB container provides service providing declaration cycle management, code generation, continuous management, security, transaction management, Lock and and issue management and other services. 74. What are the prohibition of the prohibited operation in EJB? 1. Can't operate threads and threads API (thread API means NOTINE, WAIT, etc.) IO operation directly access file system, 6. You cannot load local libraries., 7. You cannot use this as a variable and return, 8. Cannot recall. 75. The Remote Interface and Home Interface The main role REMOTE interface defines the business method for the EJB client calling business method. The HOME interface is an EJB factory for creating and removing a lookup EJB instance
76. The lifecycle of the bean instance is generally buffer in the STATELESS SESSION bean, Entity Bean, and for the existence of cache management for Entity Beans and Statefull Session Beans, which typically contains an instance, setting up context, creating EJB Object (Create) , Business methods call, remove, etc. For beans with buffer pool management, after CREATE, the instance does not remove from memory, but use buffer pool scheduling mechanisms to continuously reuse instances, and beans for Cache management, by activation and go The activation mechanism maintains the state of the bean and limits the number of instances in the memory. 77, the activation mechanism of EJB is in the STATEFUL SESSION bean as an example: its Cache size determines the number of bean instances that can exist in memory, according to the MRU or NRU algorithm, the instance is migrated between activation and deactivation state, the activation mechanism is when When the client calls an EJB instance business method, if the corresponding EJB Object is found that the corresponding bean instance does not bind the corresponding bean instance (activated) (activation) this instance from it to activate the bean storage (by serializing mechanism). The corresponding EJBACTIVE and EJBPASSIVATE methods are called before the state change. 78. Several type sessions of EJB (session) bean, entity (Entity) bean-based bean can be divided into stateful and stateless, both entity beans can be divided into BEAN management persistence (BMP) and contufficient persistence (CMP) of container management (CMP) 2 79, several basic steps of the customer service call Set the JNDI service factory and the JNDI service address system properties, find the Home interface, call from the Home Interface Create method Create a Remote interface and calls its business method through the Remote interface. 80. How to give Weblogic Specify size memory? In starting WebLogic scripts (bitservername in the Domian corresponding server directory), add SET MEM_ARGS = -XMS32M -XMX200M, adjust the minimum memory to 32m, maximum 200m81, how to set WebLogic Hot Start Mode (Development Mode) and Product Publishing Mode? You can modify the startup mode of the corresponding server as one of the development or product modes in the management console. Or modify the service startup file or Comufact of the Commenv file, add set production_mode = true. 82. Do not enter the username and password when starting? Modify the service startup file, increase the WLS_USER and WLS_PW items. You can also add an encrypted username and password in the boot.properties file. 83, after the WebLogic Management Table, a application domain (or a website, Domain) is configured after configuring information about JMS and EJB or connection pools. What file is actually saved? Save in this Domain's config.xml file, it is the core configuration file of the server.
84, talk about a Domain default directory structure in WebLogic? For example, put a simple helloworld.jsp into the point of the directory, but you can be http: // host on the browser: port number // HelloWord .jsp You can see the results of the run? Another example in which you write JavaBean how to do? Domain Directory / Server Directory / Applications, place the application directory in this directory will be used as an application access, if it is web Application, the application directory needs to meet the web application directory requirements, the JSP file can be placed directly in the application directory, JavaBean needs to be placed in the CLASSES directory of the application directory, setting the server's default application will be implemented on the browser No need to enter an app name. 85. Publishing EJB in WebLogic to involve which profiles are different types of EJBs, all involved in the configuration files involved include EJB-jar.xml, weblogic-ejb-jar.xmlcmp entity beans generally need WebLogic- CMP-RDBMS-JAR.XML 86, how to make SSL configurations in WebLogic Configuration or J2EE (Standard) for the J2EE (Standard) to implement SSL in the default installation of demoidentity.jks and demotrust.jks KeyStore, need to configure The server uses Enable SSL, configures its port, and you need to get private key and digital certificate from CA in product mode, create IDentity and Trust KeyStore, load acquired key and digital certificate. You can configure this SSL connection to one-way or two-way. 87, how to view EJBs already released in WebLogic? You can use the management console, you can view all published EJB88, what is the use of the use? CORBA standard is a public object request agency structure (Common object Request Broker Architecture, standardized by the object management organization (Object Management Group, abbreviated as OMG). Its composition is the interface definition language (IDL), language binding (binding: also translated into a cable) and an agreement to interoperate interoperability. Its purpose is to use different programming languages to run in different processes, develop in different operating systems. 89. Talk about several common modes in J2EE you are familiar with or have heard of J2EE? Some views of design patterns session facade pattern: Use sessionBean access EntityBeanMessage Facade Pattern: Implement asynchronous call EJB Command Pattern: Use Command JavaBeans to replace SessionBean To achieve a lightweight access Data Transfer Object Factory: Simplified EntityBean data by DTO Factory: Generic Attribute Access: Simplifying the EntityBean Data Provision for EntityBean Data Features Business Interface: The same interface specification business logic is implemented by remote (local) interface and Bean class. The design of sex EJB architecture will directly affect the performance, scalability, maintenanceability, component reuse and development efficiency. The more complex the project, the more important the project team, the more important it can reflect the importance of good design. 90. Talking about the MDB of the Persistent and Non-Persisten's Differential Persistent mode when developing message beans in WebLogic can guarantee the reliability of messaging, that is, if the EJB container has problems, the JMS server will still use the message in this MDB. When it is sent, the Non-Persistent method will be discarded.
91. What kind of method is generally implemented when the servlet is executed? public void init (ServletConfig config) public ServletConfig getServletConfig () public String getServletInfo () public void service (ServletRequest request, ServletResponse response) public void destroy () 92, j2ee common design patterns? Description plant mode. 23 design patterns in Java: Factory, Builder, FactoryMethod, Prototype, Singleton, Facade, Adapter ( Adapter mode), Bridge (Bridge mode), Composite, Decorator, Flyweight, Proxy, Command, Interpreter, Visitor (Interpreter Mode), Visitor Visitor Mode CHAIN OF RESPONSIBLEITY Factory mode: Factory mode is a model that is often used, and the class implemented according to the factory mode can generate an instance of a class in a set of classes according to the provided data, usually this The group has a common abstract parent class and implements the same method, but these methods have different operations for different data. First, you need to define a base class that the subclass of the class implements the method in the base class through a different method. Then need to define a factory class, and the factory class can generate different subclass examples depending on the conditions. When an example of a subclass is obtained, the developer can call the method in the base class without having to consider the instance of which a subclass is returned. 93, EJB needs to implement its business interface or home interface, please briefly describe the reasons. The remote interface and home interface do not need to be directly implemented, and their implementation code is generated by the server, and the implementation class in the program run is used as an instance of the corresponding interface type. 94. What kinds of methods are there? Please list it. Implement a rapid sort with Java.
Sort by: Insert Sort (Direct Insert, Hill Sort), Switching Sort (Bubble Sort, Rapid Sort), Select Sort (Direct Selection Sort, Stack Sort), Multiple Sort, Distribution Sort (Sort, Base Sort ) Quickly sorted pseudo code. / / Use a quick sort method to select an element from a [0: N- 1] from a [0: N- 1] as a middle, which is divided into two segments of LEFT and Right, making left The elements in the middle are equal to the fulcrum, and the elements in the RIGHT are larger than the rapid sorting method to use the fast sorting method to use the fast sorting method to use the fast sorting method to use the fast sorting method for the Right Righ T95, please Interpretation (or briefly description) WEB container: The application component (JSP, servlet) is provided with the application component (JSP, servlet), so that the JSP, servlet is interactively interactively interacting in the environment variable interface in the container, does not have to pay attention to other systems problem. There is mainly a web server to achieve. For example: Tomcat, WebLogic, WebSphere, etc. The interface provided by the container strictly abides by the Web Application standard in the J2EE specification. We call the Web Server of the above standards called the web container in J2EE. EJB container: Enterprise Java Bean container. More industry segments. He provides various management functions that run the component EJB. As long as the EJB that satisfies the J2EE specification is placed in this container, it will be managed by the container. And you can obtain system level services through ready-made interfaces. For example, email services, transaction management. JNDI: (Java Naming & Directory Interface) Java Name Directory Service. The main functionality is: Provide a directory system that allows applications from all over its own index to meet the functionality of fast finding and positioning distributed applications. JMS: (Java Message Service) Java Message Service. It mainly implements communication between the various applications. Includes point-to-point and broadcast. JTA: (Java Transaction API) Java Transaction Services. Provide a variety of distributed transaction services. The application only needs to call the interface provided. JAF: (Java Action Framework) Java Security Authentication Framework. Provide some security control frames. Let developers implement their own personal safety control strategies through a variety of deployment and customization. RMI / IIOP: (Remote Method Invocation / Internet Object Request a Intermediary Protocol) They are primarily used to serve through remote calls. For example, remotely running a program, which provides stock analysis services, we can implement them directly on your local computer. Of course, this is to communicate between heterogeneous systems through a certain specification. RMI is unique to Java. 96. How does Java language processes an exception handle, keywords: throws, throw, try, catch, finally represents what significance? Can I throw an exception in the TRY block? Java processes abnormally by object-oriented methods, and classifies a variety of different exceptions and provides a good interface. In Java, each exception is an object, which is an instance of the throwable class or other subclass. When an abnormality occurs, an exception object is thrown, and the object contains abnormal information, and the method of calling this object can be captured and processed.
Java's exception handling is achieved by 5 keywords: try, catch, throw, throws and finally. Under normal circumstances, use TRY to perform a program, if an exception occurs, the system will throw an exception, then you can capture (catch) it through its type, or finally by default processor Treatment. Use TRY to specify a program that prevents all "exceptions". Keeping followed by the Try program, a Catch clause should be included to specify the type of "exception" you want to capture. The throw statement is used to clearly throw an "exception". Throws is used to indicate a variety of "exceptions" that may be thrown by a member function. Finally is executed to ensure that "exception" occurs regardless of the code. You can write a TRY statement outside in a member function call, write another TRY statement to protect other code inside this member function. Whenever you encounter a try statement, the "exception" frame is placed on the stack until all TRY sentences are completed. If the TRY statement at the next level does not process some "exception", the stack will be expanded until the TRY sentence with this "exception" is encountered. 97, can I include multiple classes (not internal classes) in a ".java" source file? What is the limit? can. There must be only one class name with the file name. 98. All parts of MVC have those technologies to implement? How to achieve? MVC is a short written by Model-View-Controller. "Model" is the application's business logic (implemented by javabean, ejb component), "view" is the application's representation surface (generated by JSP page), "Controller" is a process control (generally a servlet) The application logic, processing procedure, and display logic are achieved by this design model into different components. These components can interact and reuse. 99. How many ways to implement a thread in Java? What is the use of keyword modified synchronization methods? Stop () and SUSPEND () methods do not recommend it? There are two implementation methods, which are inheriting the Thread class and implementing the runnable interface with the synchronized keyword modification synchronization method against the use of STOP () because it is not safe. It will release all locks acquired by the thread, and if the object is in a non-connected state, then other threads can check and modify them in that state. It is difficult to check the real problem. The suspend () method is prone to dead locks. When you call suspend (), the target thread will stop, but still hold the lock before this. At this point, any other thread cannot access the locked resource unless the thread is restored to the thread. For any thread, if they want to resume the target thread, it will cause a deadlock to use any lock resources. So you should not use Suspend (), and you should place a sign in your own Thread class, pointing out that the thread should act or hang. If the flag indicates that the thread should hang, use Wait () to enter the waiting state. If the flag indicates that the thread should be restored, use a Notify () to restart the thread. 100. How many types of streams in Java? JDK provides some abstract classes for each type of stream for inheritance, please say which classes are they? Byte stream, character stream. Byte streams are inherited in InputStream / OutputStream, and the character stream is inherited in InputStreamWriter. There are many other streams in Java.IO bag, mainly in improving performance and convenience.