Download FAQ J2EE

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
FAQ J2EE
1.) Difference between forward and send Redirect?
In the case of forward when you invoke a forward request, the request of the user is sent to
another resource on the server within the web container, without the client being informed about
the process that a different resource is going to process the request. But when a sendRedirtect
method is invoked, it causes the web container to return to the browser indicating that a new URL
should be requested. For this extra round trip process a redirect is slower than the forward.
2.) What is the difference between ServletContext and ServletConfig?
ServletContext: Defines a set of methods that a servlet uses to communicate with its servlet
container, for example, to get the MIME type of a file, dispatch requests, or write to a log file. The
ServletContext object is contained within the ServletConfig object, which the Web server provides
the servlet when the servlet is initialized
ServletConfig: The object created after a servlet is instantiated and its default constructor is read.
It is created to pass initialization information to the servlet
3.) What’s the difference between Thread and Runnable?
A Java Thread controls the main path of execution in an application. When you invoke the Java
Virtual Machine with the java command, it creates an implicit thread in which to execute the main
method. The Thread class provides a mechanism for the first thread to start-up other threads to
run in parallel with it.
The Runnable interface defines a type of class that can be run by a thread. The only method it
requires is run, which makes the interface very easy to fulfil by extending existing classes. A
Runnable class may have custom constructors and any number of other methods for
configuration and manipulation.
4.) What’s the difference between notify () and notifyAll ()?
The notify () is used to unblock one waiting thread; notifyAll () is used to unblock all of them.
Using notify () is preferable when only one blocked thread can benefit from the change.notifyAll()
is necessary to multiple threads should resume .
5.) The Native API driver:
A) Translates JDBC calls into a database-independent network protocol that is sent to a
middleware server.
B) Provides JDBC access to databases through ODBC drivers.
C) Converts JDBC commands into DBMS-specific native calls.
D) Communicates directly with the vendor’s database.
Ans: C)
6.) Which of the following can be the primary key in the entity bean?
A) The primary key can be a java primitive type.
B) The primary key can be Primitive wrapper classes.
C) None of the above.
D) Both.
Ans: B)
7.) What are transaction isolation levels in EJB?
A) Transaction_read_uncommitted
B) Transaction_read_committed
C) Transaction_repeatable_read.
D) Both A and B.
E) All the three.
Ans: E
8.) What are the contents of web module?
A web module contain:
a) JSP files
b) Java classes
c) gif and html files and
d) web component deployment descriptors
9.) What are the various types of Beans ?
The various types of beans are
1.Session Bean
2.Entity Bean
3.Message Driven Bean
10.) What are the services provided by a container?
The Various services provided by container are as follows:
a) Transaction management for the bean
b) Security for the bean
c) Persistence of the bean
d) Remote access to the bean
e) Lifecycle management of the bean
f) Database-connection pooling
g) Instance pooling for the bean