Java FAQ
We offer you quality collection of Java FAQ from core java, jsp and servlet. These java FAQ will help you to prepare for career java interview, java certification, college tests and campus interview. It will also help to update your java knowledge.
Recently Added Questions:
JSP Implicit objects are created by the web container. These implicit objects are Java objects that implement interfaces in the Servlet and JSP API. Scripting elements in a JSP page can make use of these JSP implicit objects. There are nine (9) JSP implicit objects available.
JSP Implicit Objects are as follows:
request
The JSP implicit request object is an instance of a java class that im...
<%@ 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 a java servlet class. The included file can be a static resource or a JSP...
Signature: public interface ServletConfig
ServletConfig is implemented by the servlet container to initialize a single servlet using init(). That is, you can pass initialization parameters to the servlet using the web.xml deployment descriptor. For understanding, this is similar to a constructor in a java class.
Example code:
<servlet>...
request.getRequestDispatcher("url") means the dispatch is relative to the current HTTP request.
Exam...
ServletRequest and ServletResponse are two interfaces that serve as the backbone of servlet technology implementation. They belong to the javax.servlet package.
Signature: public interface ServletRequest
Blueprint of an object to provide client request information to a servlet. The servlet container creates a ServletRequest object and sends it as an argument to the servlet's service method.
...
Technically you can define constructors in servlet. But, the declared constructor cannot access the ServletConfig object or throw a ServletException.
Then why is it not customary to declare a constructor in a servlet? Because the init() method is used to perform servlet initialization. In JDK 1.0 (servlet were written in this version), constructors for dynamically loaded Java classes such as ...