What is JSP?
JSP Interview Questions and Answers
(Continued from previous question...)
41. What is JSP?
Let's consider the answer to that from two different perspectives: that of an HTML designer and that of a Java programmer.
If you are an HTML designer, you can look at JSP technology as extending HTML to provide you with the ability to seamlessly embed snippets of Java code within your HTML pages. These bits of Java code generate dynamic content, which is embedded within the other HTML/XML content you author. Even better, JSP technology provides the means by which programmers can create new HTML/XML tags and JavaBeans components, which provide new features for HTML designers without those designers needing to learn how to program.
Note: A common misconception is that Java code embedded in a JSP page is transmitted with the HTML and executed by the user agent (such as a browser). This is not the case. A JSP page is translated into a Java servlet and executed on the server. JSP statements embedded in the JSP page become part of the servlet generated from the JSP page. The resulting servlet is executed on the server. It is never visible to the user agent.
If you are a Java programmer, you can look at JSP technology as a new, higher-level means to writing servlets. Instead of directly writing servlet classes and then emitting HTML from your servlets, you write HTML pages with Java code embedded in them. The JSP environment takes your page and dynamically compiles it. Whenever a user agent requests that page from the Web server, the servlet that was generated from your JSP code is executed, and the results are returned to the user.
(Continued on next question...)
Other Interview Questions
- What is a JSP and what is it used for?
- What is difference between custom JSP tags and beans?
- What are the two kinds of comments in JSP and what's the difference between them.
- What is JSP technology?
- What is JSP page?
- What are the implicit objects?
- How many JSP scripting elements and what are they?
- Why are JSP pages the preferred API for creating a web-based client program?
- Is JSP technology extensible?
- Can we use the constructor, instead of init(), to initialize servlet?
- How can a servlet refresh automatically if some new data has entered the database?
- The code in a finally clause will never fail to execute, right?
- How many messaging models do JMS provide for and what are they?
- What information is needed to create a TCP Socket?
- What Class.forName will do while loading drivers?
- How to Retrieve Warnings?
- How many JSP scripting elements are there and what are they?
- In the Servlet 2.4 specification SingleThreadModel has been deprecated, why?
- What are stored procedures? How is it useful?
- How do I include static files within a JSP page?
- Why does JComponent have add() and remove() methods but Component does not?
- How can I enable session tracking for JSP pages if the browser has disabled cookies?
- How do I prevent the output of my JSP or Servlet pages from being cached by the browser?
- How do you restrict page errors display in the JSP page?
- What JSP lifecycle methods can I override?
- How do I perform browser redirection from a JSP page?
- How does JSP handle run-time exceptions?
- How do I use comments within a JSP page?
- Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
- How can I implement a thread-safe JSP page?
- How can I declare methods within my JSP page?
- Can I stop JSP execution while in the midst of processing a request?
- Can a JSP page process HTML FORM data?
- Is there a way to reference the "this" variable within a JSP page?
- How do you pass control from one JSP page to another?
- Is there a way I can set the inactivity lease period on a per-session basis?
- How does a servlet communicate with a JSP page?
- How do I include static files within a JSP page?
- Can you make use of a ServletOutputStream object from within a JSP page?
- Can a JSP page instantiate a serialized bean?
- What is JSP?
- How do I mix JSP and SSI #include?
- How do I mix JSP and SSI #include? What is the difference between include directive & jsp:include action?
- How do you prevent the Creation of a Session in a JSP Page and why? What is the difference between include directive & jsp:include action?
- How do I use a scriptlet to initialize a newly instantiated bean?
- How can I set a cookie and delete a cookie from within a JSP page?
- How do you connect to the database from JSP?
- What is the page directive is used to prevent a JSP page from automatically creating a session?
- How do you delete a Cookie within a JSP?
- Can we implement an interface in a JSP?
- What is the difference between ServletContext and PageContext?
- What is the difference in using request.getRequestDispatcher() and context.getRequestDispatcher()?
- How to pass information from JSP to included JSP?
- How is JSP include directive different from JSP include action.
- Can we override the jspInit(), _jspService() and jspDestroy() methods?
- Why is _jspService() method starting with an '_' while other life cycle methods do not?
- Explain the life cycle of JSP?
- What happens when a page is statically included in another JSP page?
- A JSP page, include.jsp, has a instance variable "int a", now this page is statically included in another JSP page, index.jsp, which has a instance variable "int a" declared. What happens when the index.jsp page is requested by the client?
- Can you override jspInit() method? If yes, In which cases?
- What is the difference between directive include and jsp include?
- What is the difference between RequestDispatcher and sendRedirect?
- How does JSP handle runtime exceptions?
- How can my application get to know when a HttpSession is removed?
|