Servlet Java Interview Questions – Set 09

In the Servlet 2.4 specification SingleThreadModel has been deprecated, why Because it is not practical to have such model. Whether you set isThreadSafe to true or false, you should take care of concurrent client requests to the JSP page by synchronizing access to any shared objects defined at the page level. Can you give some … Read more

Servlet Java Interview Questions – Set 08

What is JSP tag file A source file containing a reusable fragment of JSP code that is translated into a tag handler when a JSP page is translated into a servlet. What is JSP container A container that provides the same services as a servlet container and an engine that interprets and processes JSP pages … Read more

Servlet Java Interview Questions – Set 07

When init() and Distroy() will be called init() is called whenever the servlet is loaded for the first time into the webserver.it performs certain one time activities which are required during the lifetime of the servlet.It may be some initialisation of variables or a database connection. Destroy will be called whenever the servlet is removed … Read more

Servlet Java Interview Questions – Set 06

Difference between JSP include directive and JSP include action <%@ include file=”filename” %> is the JSP include directive.At JSP page translation time, the content of the file given in the include directive is ‘pasted’ as it is, in the place where the JSP include directive is used. Then the source JSP page is converted into … Read more

Servlet Java Interview Questions – Set 05

Explain about ServletConfig Interface ServletConfig a ServletConfig object is used to obtain configuration data when it is loaded. There can be multiple ServletConfig objects in a single web application. This object defines how a servlet is to be configured is passed to a servlet in its init method. Most servlet containers provide a way to … Read more

Servlet Java Interview Questions – Set 04

How do you pass data (including JavaBeans) to a JSP from a servlet?- ?– (1) Request Lifetime: Using this technique to pass beans, a request dispatcher (using either “include” or forward”) can be called. This bean will disappear after processing this request has been completed. Servlet: request. setAttribute(”theBean”, myBean); RequestDispatcher rd = getServletContext(). getRequestDispatcher(”thepage. jsp”); … Read more

Servlet Java Interview Questions – Set 03

What is connection pooling?- With servlets, opening a database connection is a major bottleneck because we are creating and tearing down a new connection for every page request and the time taken to create connection will be more. Creating a connection pool is an ideal approach for a complicated servlet. With a connection pool, we … Read more

Servlet Java Interview Questions – Set 02

How can I set a cookie in JSP?- response. setHeader(”Set-Cookie”, “cookie string”); To give the response-object to a bean, write a method setResponse (HttpServletResponse response) – to the bean, and in jsp-file:<% bean. setResponse (response); %> What is JSP? JSP is a dynamic scripting capability for web pages that allows Java as well as a … Read more

Servlet Java Interview Questions – Set 01

What does web module contain?The web module contains: JSP files, class files for servlets, GIF and HTML files, and a Web deployment descriptor. Web modules are packaged as JAR files with a .war (Web ARchive) extension. Can you write code to sort the following string values naturally (i.e. in alphabetical order)? (JEE, Java, Servlets, JMS, … Read more

Servlet Java Interview Questions

Servlet Java Interview Questions – Set 09 Servlet Java Interview Questions – Set 08 Servlet Java Interview Questions – Set 07 Servlet Java Interview Questions – Set 06 Servlet Java Interview Questions – Set 05 Servlet Java Interview Questions – Set 04 Servlet Java Interview Questions – Set 03 Servlet Java Interview Questions – Set … Read more