javapandit.net
  • Home
  • Quick Java
    • Exception Handling
    • Collections Framework
  • Java Best Practices
  • Web Services
    • Web Service Basics
    • Ten Basic webservice concepts
    • XML
    • Apache Axis
    • Restful Web Services
  • JMS Concepts
    • JMS- MySQL
  • Hadoop
    • NoSQL DATABASEs
    • Apache Sqoop
    • Hadoop Interview Questions
  • Java 5
  • Java 8
    • Java 8 : Lambda Expressions
  • JDBC
  • Java Architect
    • Enterprise application re-platforming strategies
    • Java Memory Management
  • Java Programs
  • Technical Tips
    • How to set JAVA_HOME environment variable
    • How to create an auto increment field in Oracle?
    • Linux Commands
  • Best Java Interview Questions
    • Java Interview Questions- YouTube
  • Interview Questions
    • Java Tech interview Questions
    • Core Java Interview Questions >
      • core tech questions1
      • Java Collection interview questions
      • Java Concurrency
    • Servlets Interview Questions
    • JSP Interview Questions
    • Java Web Services Interview Questions
    • EJB Interview Questions
    • XML Interview Questions
    • JMS Interview Questions
  • Struts Interview Questions
    • Struts 2 Interview Questions
  • Java EE Architects Interview Questions
    • Java Architect Interview Questions
    • Top 10 reasons for Java Enterprise Application Performance Problems
    • Web Application Scalability Questions for IT Architect
  • JavaPandit's Blog
  • Web Services Interview Questions
  • Servlets And JSP
  • Oracle SOA Interview Questions
    • Open ESB /JBI
    • BPEL Language
  • Log4J
  • Ant
  • Maven
  • JMeter
  • JUnit
  • Apache POI Framework
  • ORCALE SERVICE BUS (OSB) Interview Questions
  • J2EE Patterns
    • Model-View-Controller (MVC)
    • Front Controller
    • DAO
    • Business Delegate
    • Session Facade
    • Service Locator
    • Transfer Object
    • Design Patterns >
      • Creational Patterns >
        • Singleton
      • Behavioural Patterns
      • Structural Patterns
    • Intercepting Filter
  • SQL Interview Questions/Lab
  • Best Wall Papers
    • Devotional Songs
  • Java Community
  • HIBERNATE
  • ORACLE CC&B
    • Oracle CC&B Interview Questions
  • Docker
  • Little Princess
    • Sai Tanvi Naming Ceremony Celebrations
    • Rice Feeding Ceremony
    • Sai Tanvi Gallery
  • APPSC Career Guidance
    • AP History
    • Indian Polity
    • Indian Economy
    • Science & Technology
    • Mental Ability and Reasoning
    • Disaster Management
    • Current Affairs and Events
    • General Sciences >
      • Biology
      • Physics
      • Chemistry
    • Previous Question Papers
  • About Us
  • Contact US
5.What are the implicit objects in JSP & differences between them?

There are nine implicit objects in JSP.

1. request : The request object represents httprequest that are trigged by service( ) invocation.              
    javax.servlet

2. response:The response object represents the servers response to request.
    javax.servlet

3. pageContext : The page context specifies the single entry point to many of the page attributes and is the convient place to put shared data. 
       
javax.servlet.jsp.pagecontext

4. session : the session object represents the session created by the current user.
                  javax.Servlet.http.HttpSession

5. application : the application object represents servlet context , obtained from servlet configaration .      
                            javax.Servlet.ServletContext

6. out : the out object represents to write the out put stream .  
                  javax.Servlet.jsp.jspWriter

7. config :the config object represents the servlet config interface from this page,and has scope attribute.              javax.Servlet.ServletConfig

8. page : The object is the Instance of page implementation servlet class that are processing the current request.    
              java.lang.Object

9. exception :  These are used for different purposes and actually u no need to create these objects in JSP. JSP container will create these objects automatically.             

                 java.lang.Throwable

You can directly use these objects.

Example:
If i want to put my username in the session in JSP.

JSP Page:  In the about page, i am using session object. But this session object is not declared in JSP file, because, this is implicit object and it will be created by the jsp container.

If u see the java file for this jsp page in the work folder of apache tomcat, u will find these objects are created.

6.What is jsp:usebean. What are the scope attributes & difference between these attributes?

page, request, session, application

7.What is difference between scriptlet and expression?

With expressions in JSP, the results of evaluating the expression are converted to a string and directly included within the output page. Typically expressions are used to display simple values of variables or return values by invoking a bean's getter methods. JSP expressions begin within tags and do not include semicolons:

But scriptlet can contain any number of language statements, variable or method declarations, or expressions that are valid in the page scripting language. Within scriptlet tags, you can declare variables or methods to use later in the file, write expressions valid in the page scripting language,use any of the JSP implicit objects or any object declared with a

8.What is Declaration ?
Declaration is used in JSP to declare methods and variables.To add a declaration, you must use the sequences to enclose your declarations.

9.How do you connect to the database from JSP ?

To be precise to connect jdbc from jsp is not good idea ofcourse if ur working on dummy projects connecting to msaccess u can very well use the same connection objects amd methods in ur scriplets and define ur connection object in init() method.

But if its real time u can use DAO design patterns which is widely used. for ex u write all ur connection object and and sql queries in a defined method later use transfer object [TO ]which is all ur fields have get/set methods and call it in business object[BO] so DAO is accessed with precaution as it is the crucial. Finally u define java bean which is a class holding get/set method implementing serialization thus the bean is called in the jsp. So never connect to jdbc directly from client side since it can be hacked by any one to get ur password or credit card info.

10.How do you call stored procedures from JSP ?
By using callable statement we can call stored procedures and functions from the database.

11.How do you restrict page errors display in the JSP page ?
set isErrorPage=false

12.How do you pass control from one JSP page to another ?
we can forward control to another jsp using  jsp action tags forward or include
Prev 1 2 3 4 5 6 7 Next
Powered by Create your own unique website with customizable templates.