Skip to main content

Commonly asked top 15 Jsp Interview Question and answers

1)what is Jsp?

        JSP stands for Java Server Pages. It is a presentation layer technology independent of platform. They are like HTML pages but with Java code pieces embedded in them. They are saved with a .jsp extension. It is used for viewing the page to the user. Jsp is for an dynamic pages.

2)Explain Implicit objects in JSP?

       objects are created from the web container. They are

             1)response
             2)exception
             3)application
             4)request
             5)config
             6)out
             8)page
             9)pagecontex

3) Differentiate between response.sendRedirect(url) and <jsp:forward page = …> .?

               response.sendRedirect(url): It will create a new request for each and everytime. It based on the http address.
     <jsp:forward page ="extension.jsp"> : It will forward the jsp page from one to the another, but it should be a same application context.

4)what are the java Lifecycle?
      jspinit();
      jspservice()
      jspdestroy()

5)Which implicit object is not available in normal JSP pages?

      JSP exception implicit object is not available in normal JSP pages and it's used in JSP error pages only to catch the exception thrown by the JSP pages and provide useful message to the client.

6)Why don't we need to configure JSP standard tags in web.xml?

           We don't need to configure JSP standard tags in web.xml because the TLD files are inside the META-INF directory of the JSTL jar files. When container loads the web application and find TLD files inside the META-INF directory of JAR file, it automatically configures them to be used directly in the application JSP pages. All we need to do it to include it in the JSP page using taglib directive. taglib will take care of everything to configure and execute the jsp page. We need define the taglib in the jsp page itself.

7)what is Experience Language?

     It simplifies the accessibility of the data stored in the java bean.

8)what are the scripting elements in java?

  •          Scriplet tag
  •          Expression tag
  •          Declaration tag

9)what is Scriplet Tag?

            A Scriplet tag is used to execute java code.
           <%java code%>
       example:
                <html>
                <body>
                  <% out.println("Welcome to the jsp")%>
              </body>
          </html>

10)What is Expression Tag?

            It is used to written the to the output stream of the response.
   Syntax:
              <%= statement %>

11)What is Declaration tag?

        It is used to declare fields and methods

     syntax:
             <%!  declare here %>

12)what is the purpose of using JSP page?
            Jsp technology enables the web developers to add the java code and some predefined action into static content. Java server page get converted into java servlet by the JSP complier. 

13)What are the advantages of jsp?

  1. JSP represents an HTML page embed with Java code.
  2. JSP is cross-platform technology.
  3. JSP can create database-driven Web applications.
  4. JSP enables Server-side programming abilities.

14)Which of the JSP life cycle methods you can override?

                You can’t override the _jspService() Method within a JSP page. However, there are two approaches you can take to override the jspInit() and jspDestroy() methods within the JSP page.

               jspInit() Can be quite useful for reserving resources like DB connections, N/W connections, and so forth for the JSP page.To free any allocated resources in the jspDestroy() method.


15)How many tags are exist in JSTL tags?

         *Core tags.
         *Localization tags.
         *JSTL function tags.
         *XML tags
         *SQL tags

16)What is the purpose of the <jsp: useBean> action?

           The <jsp: useBean> standard action allows to identify an existing JavaBean or to create the one if it doesn’t exist. It is used to locate the Bean class.


                        
              









Comments

Popular posts from this blog

Commonly asked Top 26 Java Interview Questions

1.what is a transient variable? A transient variable is a variable that may not be serialized. If you don't want to serialize any objects then we have to use Transient Keyword. 2. Why do threads block on I/O? Threads block on i/o (that enters the waiting state) so that other threads may execute while the i/o Operation is performed. So your blocked thread of execution blocks only that: the thread of execution. 3. How are Observer and Observable used? Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects(refer 1.4). 4. What is synchronization and why is it important?                      With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Withou

MYSQL Interview question..

MySQL is an open source relational database management system RDBMS based on Structured Query Language SQL MySQL runs on virtually all platforms, including Linux, Unix, Windows. Although it can be used in a wide range of applications, MySQL is most often associated with web-based applications and online publishing and is an important component of an open source enterprise. 1) What is SQL? SQL stands for Structured Query Language. SQL was initially developed at IBM in 1970s. SQL is the standard language to communicate with relational database management systems like Oracle, MS Access, MS SQL Server, MySQL, DB2 etc. It is used to connect the objects with the database . 2)what is the Purpose of SQL? • SQL is used to Create New Databases. • SQL is used to Create New Tables in a Database. • SQL is used to Insert, update, Delete records in a Database. • SQL is used to Retrieve data from a Database. • SQL is used to execute queries against a Database. • SQL can set permis

Top Most Important Multithreading interview question and answers

1) What is Thread in java? Threads consumes CPU in best possible manner, hence enables multi processing. Multi threading reduces idle time of CPU which improves performance of application. Thread are light weight process. It belongs to java.lang package. It can run mutiple threads simutaneously .                                                               2) How to implements threads in java?         By   implementing java.lang.Runnable interface or extending java.lang.Thread class and then extending run method.   Thread creation by implementing java.lang.Runnable interface.      And then create Thread object by calling constructor and passing reference of Runnable interface i.e. runnable object          Thread thread = new Thread(runnable); 3) We should implement Runnable interface or extend Thread class. What are differences between implementing Runnable and extending Thread?                 you must extend Thread only when you are look