Professional Documents
Culture Documents
Adv - Java IQ
Adv - Java IQ
Servlets
1.De ne Java Servlet?
Ans: A Java Servlet is a simple Java Class, which is dynamically loaded onto Web Server and therefore, enhances the functionality of the Web Server. A
Java Servlet is secure and portable as it runs on the Web Server and cannot operate outside its domain.
2. De ne Servlet Container?
Ans: Servlet Container, sometimes also known as Servlet Engine, is an integrated set of objects that provide runtime environment for java Servlet
componenets. In other words, it is a system that manages Java Servlet components on top of a Web Server to handle the Web client requests.
Ans: The Servlet API is part of the Java Servlet Speci cation designed by Sun-JCP. This API is supported by all Servlet Containers. This API contains
classes and Interfaces that de ne a standard contract between the Servlet Class and Servlet Container.
5. De ne getParameter() method?
Ans : This getParameter() method is used to get the parameter values from the ServletRequest Object into Servlet Program. This method is available
from javax.servlet.ServletRequest.
6. De ne getInitParameter() method?
Ans : This getInitParameter() method is used to get the initializaed parameter valaue from javax.servlet.ServletCon g and
javax.servlet.ServletContext.
Ans: The include() method of the RequestDispatcher object includes the response of another Servlet into the calling Servlet. You can invoke this
method any time from the calling Servlet while servicing request.
Ans: The forward() method of RequestDispatcher forwards requests to the navigated resource, such as Servlet (target Servlet) and this method can be
invoked by the Servlet while servicing the request when no output has been committed.
int getBu erSize() : Gets the bu er size of the Underlying bu er being used.
Boolean isCommited() : Returns true if the response bytes have been sent to client; Otherwise it returns false.
Reset() : Clears the data in the bu er , including the status codes and headers sets, if the response is not committed.
resetBu er() : Clears the data in the bu er if the response in not Committed.
Update Your Skills form our Experts & Enroll Now for Advanced Java Online Training
=>URL rewriting
=>Cookies
=>HTTP Session
11. De ne Session?
Ans: A Session is collection of HTTP requests over a period of time between a client and a Web Server. The lifetime of a session speci es the period of
time till the session is active. When a session expires, the session is destroyed, and its resources are returned to the Servlet Engine.
Page : Starts when a request enters the service method of a Servlet and ends as a request leaves the service method.
Request : Starts when a request object comes into the scope of a Web Component and ends when the request object goes out of the Web
Component scope.
Session : Starts when a client request enters the session and ends when the client leaves the Session.
Context(or)application : Starts when a Web application is started and ends when the Web Application is destroyed.
=>When getSession(false) method is used, the Web container tries to locate and return the Session, but if the Web Container is not able to locate the
session, it returns null.
=>when getSesssion() or getSession(true) is used, the Web Container tries to locate the Session and returns it, but if the Web Container is not able to
locate the Session, it creates new session and associates it with the client request.
<init-param> tag part of web.xml will initialize the parameters in ServletCon g object
<context-param> tag part of web.xml will initialize the parameters in ServletContext object
(a)Direct servlet manipulation : In this a Servlet can gain access rights to the currently running servlets and can perform operations on each of
then.
(b)Servlet reuse : This is a method where one servlet uses another’s servlet capability for its own purpose.
(c)Servlet collaboration : This is most widely used interservlet communication. It includes two or more servlets sharing the state data. The Servlet
collaboration can be done through the system properties list, shared objects, and inheritance.
JSP
1. What is JSP?
Ans: JSP is totally tag-based, which means that each piece of code in JSP is enclosed within a tag. JSP tags reduce the necessity of large amount of Java
Code in JSP pages by implementing the functionality of the tags into tag implementation classes.These tags help developers build dynamic pages,
improve their code by reducing Java code, separate the presentation logic from the business logic.
2. JSP Architectures?
Ans: JSP speci cations demonstrate two approaches to build Web applications by using JSP. These approaches are known as JSP Model 1 and Model 2
architectures.
Ans:
(i)Page Translation
(ii)Compilation
(iv)Request Handling
(v)Destroing
Update Your Skills form our Experts & Enroll Now for Advanced Java Online Training
4. De ne Scripting tags?
Ans: JSP Scripting tags, also called as JSP Scripting elements, allow you to add a script code into the Java code of a JSP page generated by the JSP
translator.
Scriptlet tag
<%
%>
Declarative tags
<%!
%>
Expression tag
<%=
%>
6. JSP implicit objects?
Ans: JSP implicit objects are used in a JSP page to make the page dynamic .The dynamic content can be created and accessed by using Java Objects
within the Scripting elements. JSP implicit objects are prede ned objects that are accessible to all JSP pages. These objects are called implicit objects
because you don’t need to instantiate them. The JSP container automatically instantiates these objects while writing the script content in the scriptlet
and expression tags.
->request
->response
->out
->page
->pageContext
->application
->session
->con g
->exception
8. De ne Directive tags?
Ans : Directive tags are used to give directions used by the JSP translator during translation stage of the JSP life cycle. These tags are used to set global
values such as class declarations, methods to be implemented, output content type, and so on.
(a)page
(b)include
(c)taglib
(a)page:
The page directive tag holds the instructions used by the translator during the translation stage of the JSP life cycle. These instructions a ect the
various properties associated with the whole JSP page.
(b)include:
The include directive tage is used to merge the contents of two or more les during the translation stage of the JSP life cycle. The include directive tag
adds text of the included le to the JSP page, without any processing or modi cation.
(c)taglib:
The taglib directive tag is used to declare a custom tag lib in JSP page so that the tags related to that custom tag library can be used in the same JSP
page.
10.What is JavaBean?
Ans: JavaBeans are reusable software components that separate the business logic from the presentation logic. In general, JavaBeans are simple Java
classes that follow certain speci cations to develop dynamic content.
11.Advantages of JavaBeans?
Ans:
(i)With the use of JavaBeans, users can menage presentation code and business logic separately.
(ii)Using JavaBeans with JSP has made object sharing between multiple Web pages simple
(iii)Using JavaBeans with JSP has simpli ed the process of request and response handling.
Update Your Skills form our Experts & Enroll Now for Advanced Java Online Training
<jsp:forward>
<jsp:param>
<jsp:useBean>
<jsp:setProperty>
<jsp:getProperty>
<jsp:plugin>
<jsp:params>
<jsp:fallback>
<jsp:attribute>
<jsp:body>
<jsp:element>
<jsp:text>
14.What is the di erence between include directive tag and include Action tags?
(i)The “include” directive tag inserts the given page and includes the content in the generated Servlet page during the translation phase of the JSP life
cycle.
(ii)The “include” action tag is used to include the response generated b executing the speci ed JSP page or Servlet. The response is included during the
request processing phase, when the page is requested b the user.
(ii)These are able to access all the objects available in a JSP page.
(iii)These are used to modify the response generated by calling the attributes from the main page
(v)The Custom tags can be nested within each other to provide complexit in a JSP page.
->pageScope
->requestScope
->sessionScope
->applicationScope
->param
->paramValues
->header
->headerValues
->cookie
->initParam
18.De ne JSTL?
Ans:JSTL stands for JSP Standard Tag Library , which is a collection of custom tag libraries, which provides core functionality used for JSP documents.
JSTL reduces the use of Scriptlets in JSP page. The use of JSTL tags allows developers to use prede ned tags instead of writing the JavaCode.
(ii)XML tags : Used for parsing,selecting, and transforming XML data in JSP page
(iii)Format tags :Used for formatting the data used in JSP page
(iv)SQL tags: Used to access the relational Database used in JSP page
JDBC
(iii)CallableStatement – Executes parameterized SQL statement that invokes DB procedure or function and supports IN and OUT parameters
2.De ne Transaction?
Ans:Transaction is a set of statements executed on a resource or resources applying ACID(Atomocity,Consistency,Isolation,Durability) properties.
(i)DatabaseMetaData
(ii)ParameterMetaData
(iii)ResultSetMetaData
Update Your Skills form our Experts & Enroll Now for Advanced Java Online Training
Update Your Skills form our Experts & Enroll Now for Advanced Java Online Training
Name *
Email *
Contact No *
Mode of Training *
Online Training
State
Course *
Select Course
Submit
Live Trainnig
READ OUR ARTICLES
C Objective Questions 8
C Objective Questions 7
POPULAR COURSES
Reach Us@
Address:
2nd Floor, Durga Bhavani Plaza, Satyam Theatre Road, Ameerpet, Hyderabad, Telangana 500016
Phone:
(040) 2374 6666
Email:
info@nareshit.com
Working Days/Hours :
Mon - Sun / 6:00 AM - 9:30 PM
Useful Links
Blog
Contact us
Placement Registration
NareshIT Reviews
Google+ 4.4 on 2565 Reviews
Facebook 4.6 on 654 Reviews
EduGorilla 4.9 on 103 Reviews
Sulekha 4.0 283 Reviews
Justdial 4.1 on 5102 Reviews
Urbanpro 5.0 on 161 Reviews
Local Enquiry 5.0 on Reviews
+91 8179191999
Whatsapp:
+91 8179191999
USA:
+1 4042329879
onlinetraining@nareshit.com
Follow Us
Online Training in
Hyderabad, Bangalore, Chennai, Pune, Noida, Australia, Canada, UK, USA, Boston, California, Chicago, Dallas, New York, Orlando, Washington.