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);

  • Monday, May 7, 2012

    IF APACHE TOMCAT WON'T START...............?

    IF APACHE TOMCAT WON''T START...............?
    Some times the apache tomcat wont start after installation
    a simple two step process can solve your problem
    1.go to bin directory of java and COPY the file msvcr71.dll .
    2.PASTE this file in the bin directory of tomcat
    now start your tomcat ,it will start.
    it worked for me :)
    note:if u didnt find the file ,then you can simply download it from net
    method 2:
    1)open the command prompt
    2)set path to bin dir of apache tomcat
    eg:  C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin
    3)now type ' java -jar bootstrap.jar '
    4)press enter,now your server starts running.