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