Pages

Subscribe:

Ads 468x60px

Labels

Social Icons

*

Friday, August 17, 2012

JDBC and JSP interview questions



  • What is the query used to display all tables names in SQL Server (Query analyzer)?
     select * from information_schema.tables
  • How many types of JDBC Drivers are present and what are they?- There are 4 types of JDBC Drivers
    • JDBC-ODBC Bridge Driver
    • Native API Partly Java Driver
    • Network protocol Driver
    • JDBC Net pure Java Driver
  • Can we implement an interface in a JSP?- No
  • What is the difference between ServletContext and PageContext?- ServletContext: Gives the information about the container. PageContext: Gives the information about the Request
  • What is the difference in using request.getRequestDispatcher() and context.getRequestDispatcher()?- request.getRequestDispatcher(path): In order to create it we need to give the relative path of the resource, context.getRequestDispatcher(path): In order to create it we need to give the absolute path of the resource.
  • How to pass information from JSP to included JSP?- Using <%jsp:param> tag.
  • What is the difference between directive include and jsp include?- <%@ include>: Used to include static resources during translation time. JSP include: Used to include dynamic content or static content during runtime.
  • What is the difference between RequestDispatcher and sendRedirect?- RequestDispatcher: server-side redirect with request and response objects. sendRedirect : Client-side redirect with new request and response objects.
  • How does JSP handle runtime exceptions?- Using errorPage attribute of page directive and also we need to specify isErrorPage=true if the current page is intended to URL redirecting of a JSP.
  • How do you delete a Cookie within a JSP?
     Cookie mycook = new Cookie(\"name\",\"value\");
    
     response.addCookie(mycook);
    
     Cookie killmycook = new Cookie(\"mycook\",\"value\");
    
     killmycook.setMaxAge(0);
    
     killmycook.setPath(\"/\");
    
     killmycook.addCookie(killmycook);

  • 0 comments:

    Post a Comment