-
-
-
-
-
-
How do I have the JSP-generated servlet subclass my own custom servlet class, instead of the default?
One should be very careful when having JSP pages extend custom servlet classes as opposed to the default one generated by the JSP engine. In doing so, you may lose out on any advanced optimization that may be provided by the JSPengine. In any case, your new superclass has to fulfill the contract with the JSPngine by: Implementing the HttpJspPage interface, if the protocol used is HTTP, or implementing...
-
How do I use comments within a JSP page?
You can use "JSP-style" comments to selectively block out code while debugging or simply to comment your scriptlets. JSP comments are not visible at the client.For example:<%-- the scriptlet is now commented out<%out.println("Hello World");%>--%>You can also use HTML-style comments anywhere within your JSP page. These comments are visible at the client. For example:<!-- (c) 2004 javagalaxy.com...
-
-
-
What is the difference between GenericServlet and HttpServlet?
GenericServlet is for servlets that might not use HTTP, like for instance FTP service.As of only Http is implemented completely in HttpServlet. The GenericServlet has a service() method that gets called when a client request is made. This means that it gets called by both incoming requests and the HTTP requests are given to the servlet as they are.
-
What is the servlet life cycle?
Each servlet has the same life cycle:A server loads and initializes the servlet (init())The servlet handles zero or more client requests (service())The server removes the servlet (destroy()) (some servers do this step only when they shut down)
-
What information that the ServletResponse interface gives the servlet methods for replying to the client?
It Allows the servlet to set the content length and MIME type of the reply. Provides an output stream, ServletOutputStream and a Writer through which the servlet can send the reply data.
-
What are the advantages using servlets than using CGI?
Servlets provide a way to generate dynamic documents that is both easier to write and faster to run. It is efficient, convenient, powerful, portable, secure and inexpensive. Servlets also address the problem of doing server-side programming with platform-specific APIs. they are developed with Java Servlet API, a standard Java extension.
-
-
-
C: namesList = context.listContents(someContextName);
Binding binding = namesList.next();
MyObject obj = binding.getObject();
D: namesList = context.list(someContextName);
Binding binding = namesList.next();
MyObject obj = (MyObject) binding.getObject("MyObject");
">To create a DSI (Dynamic Skeleton Interface) based server, the server must extendA: org.omg.CORBA.DynamicImplementation B: org.omg.CORBA.DynamicSkeleton C: org.omg.CORBA.SkeletonInterface D: org.omg.CORBA.DSIHow would you get the actual bound object of type MyObject using JNDI?A: namesList = context.listBindings(someContextName); Binding binding = namesList.next(); MyObject obj = (MyObject) binding.getObject(); B: namesList = context.listBindings(someContextName); Binding binding = namesList.next(); MyObject obj = binding.getObject("MyObject"); C: namesList = context.listContents(someContextName); Binding binding = namesList.next(); MyObject obj = binding.getObject(); D: namesList = context.list(someContextName); Binding binding = namesList.next(); MyObject obj = (MyObject) binding.getObject("MyObject");
-
-
-
-
JSP Interview Questions
Ans