JSP Interview Questions
Explains what is meant by an output comment in JSP?
JSP handles the comment sent to the user as like any other pages. This comment that is rendered to the client as a page is called the output comment. This will be handled as a HTML text and this will be rendered as a HTML output on the user browser.
What is required to run JSP? Do I need to install the J2EE SDK or do I only need a web server?
Java Server Pages (“JSP”) require a web server and a Java 2 Platform, Standard Edition (“J2SE”) Implementation to run. The J2EE SDK, has the functionality needed for running JSP pages. JSP technology is one of the J2EE SDK technologies. If you want to use JSP pages with other J2EE SDK technologies, e.g. Enterprise JavaBean (“EJB”) technology, using the J2EE SDK are a good choice.
Is there a mechanism by which we can implement an interface in JSP?
No. We can’t implement an interface in a JSP
Explain the difference between ServletContext and PageContext?
The information about the container which the application is running is provided by the ‘ServletContext’. The information about the Request in provided by the ‘PageContext’
Explain the difference in using the request.getRequestDispatcher() and context.getRequestDispatcher()?request.getRequestDispatcher(path) is used to give the relative path of the resource context.getRequestDispatcher(path) is used to give the absolute path of the resource.
In what way you can pass the information form one JSP to an included JSP?
This can be achieved using the <%jsp:param> tag.
Explain the difference between jsp include and directive include?
When we need to include static resource during the translation time, the ‘<%@ include>’ is used.The JSP include is used when we need to have dynamic or static data at run time.