JSP Interview : JSP Interview Questions -2

Page of the JSP Interview Questions.

JSP Interview : JSP Interview Questions -2

JSP Interview : JSP Interview Questions -2

     

Page of the JSP Interview Questions.

Question: What is JSP Custom tags?
Answer: JSP Custom tags are user defined JSP language element. JSP custom tags are user defined tags that can encapsulate common functionality. For example you can write your own tag to access the database and performing database operations. You can also write custom tag for encapsulate both simple and complex behaviors in an easy to use syntax and greatly simplify the readability of JSP pages.

Question: What is JSP?
Answer: JavaServer Pages (JSP) technology is the Java platform technology for delivering dynamic content to web clients in a portable, secure and well-defined way. The JavaServer Pages specification extends the Java Servlet API to provide web application developers

Question: What is the role of JSP in MVC Model?
Answer: JSP is mostly used to develop the user interface, It plays are role of View in the MVC Model.

Question: What do you understand by context initialization parameters?
Answer: The context-param element contains the declaration of a web application's servlet context initialization parameters. 
<context-param>
  <param-name>name</param-name>
  <param-value>value</param-value>
</context-param>

The Context Parameters page lets you manage parameters that are accessed through the ServletContext.getInitParameterNames and ServletContext.getInitParameter methods.

Question: Can you extend JSP technology?
Answer: JSP technology lets the programmer to extend the jsp to make the programming more easier. JSP can be extended and custom actions and tag libraries can be developed.

Question: What do you understand by JSP translation?
Answer: JSP translators generate standard Java code for a JSP page implementation class. This class is essentially a servlet class wrapped with features for JSP functionality.

Question: What you can stop the browser to cash your page?
Answer: Instead of deleting a cache, you can force the browser not to catch the page.
<% 
response.setHeader("pragma","no-cache");//HTTP 1.1 
response.setHeader("Cache-Control","no-cache"); 
response.setHeader("Cache-Control","no-store"); 
response.addDateHeader("Expires", -1); 
response.setDateHeader("max-age", 0); 
//response.setIntHeader ("Expires", -1); //prevents caching at the proxy server 
response.addHeader("cache-Control", "private"); 

%>
put the above code in your page.

Question: What you will handle the runtime exception in your jsp page?
Answer: The errorPage attribute of the page directive can be used to catch run-time exceptions automatically and then forwarded to an error processing page. 

For example:
<%@ page errorPage="customerror.jsp" %> 
above code forwards the request to "customerror.jsp"  page if an uncaught exception is encountered during request processing. Within "customerror.jsp", you must indicate that it is an error-processing page, via the directive: <%@ page isErrorPage="true" %>.