Top Servlets Interview Questions :: ALLInterview.com http://www.allinterview.com Top Servlets Interview Questions en-us Difference between Include, Forward and sendRedirect in Servlet? http://www.allinterview.com/showanswers/10954.html Response.sendRedirect () This function is used, when we want to redirect the client request to some other site (i.e out of our context) or when ever we want to redirect errors. If you are using sendRedirect (), then it will be visible to the what is the difference between Servlet and JSP?Advantage of JSP over http://www.allinterview.com/showanswers/10953.html . The main difference between them is, In servlets both the presentation and business logic are place it together. Where as in jsp both are saparated by defining by java beans . In jsp's the overall code is modulated so the developer w What is the difference between servlet config and servlet context. http://www.allinterview.com/showanswers/28139.html Servlet config is a private area for every servlet.Any variable stored there is accessible to only that servlet while sevlet context is a shared area for every servlet in an application.In an aaplication every servlet can access the variable How do you pass the data from one servlet to another servlet? http://www.allinterview.com/showanswers/6848.html Using Request Dispatcher, you can send the values and forward to another page. ServletContext.getRequestDispatcher(); reqDispatcher.forward(req,res) Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the What is ServletContext() and what is its use? http://www.allinterview.com/showanswers/2442.html Assume that ServletContext is shared momeroy for all servelts which are existed in a web application, we can place an object on to the servletcontext, and that can uses all other servlets which are exited in the web application. What is difference between Forward() and sendRedirect() methode? http://www.allinterview.com/showanswers/10790.html In the case of forward() the server will redirect to the next page but in the case of sendRedirct() the server will inform the browser to redirect the url to the next page. Can we override the ActionServlet? http://www.allinterview.com/showanswers/6897.html Yes we can modify the functionality of Action Servlet. to do this we have to extend the RequestProcessor class and overwrite the processPreprocess method. and then add following tag in Struts-config.xml <processor className="org.abc.co What is Single Threaded Model in Servlets? Explain this with an exam http://www.allinterview.com/showanswers/1601.html Single Thread Model ensures that servlet handles only one request at a time.When YOUR CLASS IMPLEMENTS THIS INTERFACE WE ARE GUARENTEED THAT no two threads run simultaneously in service() method. this is a marker interface which contains no me Which method the Servlet container call to create the instance of th http://www.allinterview.com/showanswers/16906.html servlet container creates the init() method can i call destroy() method in init() method of servlet http://www.allinterview.com/showanswers/23275.html yes, u can call destroy() method in init() of Servlet. but calling destroy() in this way doesnt unload servlet from servlet container. can servlet have instance variables? http://www.allinterview.com/showanswers/56873.html yes waht is the main diference b/w servelts and JSP ? http://www.allinterview.com/showanswers/987.html there are minor difference btw these two.Servlet is used for processing afterall containter is servlet engine.It perform many task like load balancing,request processing,generating image on fly.But if we want to responce an html format than t how can we create object to a class in a jsp file? http://www.allinterview.com/showanswers/36659.html use the page import tag to import ur class and execute methods of the class < % @ page import = packageName.Classname %> <% ImportedClass object = new ImportedClass(); object.executeMethods(); %> Please check for some docu can we create more than ServletContext and ServletConfig in your appl http://www.allinterview.com/showanswers/37168.html ServletContext which is managed by webcontainer, For the whole web application only one servletcontext will be there... In ServletConfig , this is also managed by webcontainer, for every request object one servletconfig object will be the can i call init() method in destroy() method of servlset. ? http://www.allinterview.com/showanswers/23274.html Yes We can Call init() method from destroy() of Servlet