Java - Interview Questions and Answers for 'Servlets' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Core Java, Java, JDBC, Servlet, JSP, Java



Link: https://www.facebook.com/groups/tutorial4us/
   




Interview Questions and Answers for 'Servlets' - 18 question(s) found - Order By Newest

 Q1. What is session tracking and how do you track a user session in servlets?Java EE
Admin
info@buggybread.com
Ans. Session tracking is a mechanism that servlets use to maintain state about a series requests from the same user across some period of time. The methods used for session tracking are:

User Authentication - occurs when a web server restricts access to some of its resources to only those clients that log in using a recognized username and password

Hidden form fields - fields are added to an HTML form that are not displayed in the client's browser. When the form containing the fields is submitted, the fields are sent back to the server

URL rewriting - every URL that the user clicks on is dynamically modified or rewritten to include extra information. The extra information can be in the form of extra path information, added parameters or some custom, server-specific URL change.

Cookies - a bit of information that is sent by a web server to a browser and which can later be read back from that browser.

HttpSession- places a limit on the number of sessions that can exist in memory.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlets   session   session management   web applications   cookies   httpsession   url rewriting   architecture     Infosys


Frequently asked. Among first few questions in the J2EE segment of interview.
  Q2. What is the use of deployment descriptor ?Java EE2016-06-04 22:46:40

Ans. Deployment Descriptor which is usually web.xml is used to specify the classes, resources and configuration of the application and how the web server uses them to serve web requests.This file is usually added to WEB-INF folder and contains following

* Servlet entries and url mapping
* Plugins
* Some info regarding authentication / filters
* Landing Page
* Event Handlers

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     web.xml   servlets  deployment descriptor     The NewBury Corp  Fast Dolphin  uCertify  General Electric  Cognizant (CTS)  Web coop  HCL Technologies  Tara Consultancy (TCS)  Wipro  Infosys  Cognizant (CTS)  Sonatype  IBM  computer science corporation (CSC)      basic        frequent

Try 1 Question(s) Test


 Q3. Can we have multiple servlets in a web application and How can we do that ?Java EE
Anonymous
Ans. Yes by making entries in web.xml

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlets   servelets   web application   java   web.xml   yes-no   architecture


 Q4. Difference between socket and servlet ?Java EE
Admin
info@buggybread.com
Ans. servlet is a small, server-resident program that typically runs automatically in response to user input.
A network socket is an endpoint of an inter-process communication flow across a computer network.

We can think of it as a difference between door and gate. They are similar as they both are entry points but they are different as they are put up at different areas.

Sockets are for low-level network communication whereas Servlets are for implementing websites and web services

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   j2ee   networking   servlet   socket   difference between.java.net   technologies   architecture


 Q5. What are different types of cookies ?Java EE
Admin
info@buggybread.com
Ans. Session cookies , which are deleted once the session is over.

Permanent cookies , which stays at client PC even if the session is disconnected.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlets   session   session management   web applications   cookies   httpsession


 Q6. What is servlet Chaining ?Java EE
Anonymous
Ans. Multiple servlets serving the request in chain.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   web application   servlets     Barclays        rare


 Q7. What is a config Object?
Java EE
Anonymous
Ans. The config object is an instantiation of javax.servlet.ServletConfig and is a direct wrapper around the ServletConfig object for the generated servlet. This object allows the JSP programmer access to the Servlet or JSP engine initialization parameters such as the paths or file location.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlet   jsp   servlet config   servletconfig   javax


 Q8. What is a pageContext Object?
Java EE
Anonymous
Ans. The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The pageContext object is used to represent the entire JSP page. This object stores references to the request and response objects for each request. The application, config, session, and out objects are derived by accessing attributes of this object.The pageContext object also contains information about the directives issued to the JSP page, including the buffering information, the errorPageURL, and page scope.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlet   jsp   pagecontext   page context


 Q9. What are the phases of the JSP life cycle ?Java EE
Admin
info@buggybread.com
Ans. Translation of JSP PageCompilation of JSP PageClassloading (class file is loaded by the classloader)Instantiation (Object of the Generated Servlet is created).Initialization ( jspInit() method is invoked by the container).Reqeust processing ( _jspService() method is invoked by the container).Destroy ( jspDestroy() method is invoked by the container).

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlets   servelets   web application   jsp   jsp life cycle   mindtree     Span Infotech  PTC  Cybage  iNautix Technologies  TechAspect  Brillio  Modus Information Systems  SAG Infotech   TechProcess Payment Services



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. What are JSP directives ? What are different types of directives ?Java EE
Admin
info@buggybread.com
Ans. The jsp directives are messages that tells the web container how to translate a JSP page into the corresponding servlet.

There are three types of directives -

page directive
include directive
taglib directive

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlets   servelets   web application   jsp   jsp ldirectives


 Q11. What are advantages of using Servlets over CGI ?Java EE
Admin
info@buggybread.com
Ans. Better Performance as Servlets doesn't require a separate process for a single request.

Servlets are platform independent as they are written in Java.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   j2ee   servlets   servelets   cgi


 Q12. What is the use of HTTPSession in relation to http protocol ?Java EE
Admin
Admin
Ans. http protocol on its own is stateless. So it helps in identifying the relationship between multiple stateless request as they come from a single source.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlets   web application   session   httpsession   architecture     uCertify


 Q13. Why using cookie to store session info is a better idea than just using session info in the request ?Java EE
Admin
info@buggybread.com
Ans. Session info in the request can be intercepted and hence a vulnerability. Cookie can be read and write by respective domain only and make sure that right session information is being passed by the client.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlets   session   session management   web applications   cookies   httpsession   architecture


 Q14. http protocol is by default ... ?Java EE
Admin
info@buggybread.com
Ans. stateless

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     j2ee   servlets   session   session management   web applications   cookies   httpsession   architecture


 Q15. Are Servlet classes Thread Safe ?Java EE
Prabhakar
kumar12abhakar@gmail.com
Ans. No

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     servlets   j2ee    web


 Q16. What is the difference between ServletConfig and ServletContext ?Java EE2017-01-03 09:51:14

Ans. http://www.java4s.com/java-servlet-tutorials/difference-between-servletconfig-and-servletcontext-in-java/

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     ServletConfig  ServletContext     Fidelity National Information Services (FIS)


 Q17. What is a Servlet Filter ?Java EE2017-01-19 11:33:37

Ans. It's an object that can intercept http request and response and hence we can take appropriate action on those requests.

There are different types of filters based on Specifications like

Authentication
Logging
Encryption
Tokenizing

etc

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     servlets  servlet filters     Synechron  NexThoughts  Populus Group      basic        frequent


 Q18. What are the advantages of Spring interceptor over Servlet Filters ?Spring2017-01-30 10:30:32

Ans. Spring Interceptor are Spring beans and hence they can inject other beans and can be used with other Spring frameworks concepts like AOP.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     interceptors  servlet filters  spring interceptors vs servlet filters




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: