Oracle Java Interview Questions & Answers Set-11

«« Previous
Next »»

201) What are the different scope values for the <jsp:useBean> tag?
Ans: There are 4 values:
  • page
  • request
  • session
  • application

202) What is the difference between ServletContext and PageContext?-
Ans: ServletContext gives the information about the container whereas PageContext gives the information about the Request.

203) What is the difference in using request.getRequestDispatcher() and context.getRequestDispatcher()?
Ans: request.getRequestDispatcher(path) is used in order to create it we need to give the relative path of the resource whereas context.getRequestDispatcher(path) in order to create it we need to give the absolute path of the resource.

204) What is EL in JSP?
Ans: The Expression Language(EL) is used in JSP to simplify the accessibility of objects. It provides many objects that can be used directly like param, requestScope, sessionScope, applicationScope, request, session etc.

205)What is basic differences between the JSP custom tags and java beans?
  • Custom tags can manipulate JSP content whereas beans cannot.
  • Complex operations can be reduced to a significantly simpler form with custom tags than with beans.
  • Custom tags require quite a bit more work to set up than do beans.
  • Custom tags are available only in JSP 1.1 and later, but beans can be used in all JSP 1.x versions.

206) Can an interface be implemented in the jsp file ?
Ans: No.

207) What is JSTL?
Ans: JSP Standard Tag Library is library of predefined tags that ease the development of JSP.

208) How many tags are provided in JSTL?
Ans: There are 5 type of JSTL tags.
  1. core tags
  2. sql tags
  3. xml tags
  4. internationalization tags
  5. functions tags

209) Which directive is used in jsp custom tag?
Ans: The jsp taglib directive.

210) What are the 3 tags used in JSP bean development?
  • jsp:useBean
  • jsp:setProperty
  • jsp:getProperty

211) How to disable session in JSP?
Ans:  <%@ page session="false" %>

EJB Interview Questions

212) What is EJB?
Ans: EJB stands for Enterprise Java Bean. It is a server-side component to develop scalable, robust and secured enterprise applications in java.

213) What are the types of Enterprise Bean?
Ans: There are 3 types of enterprise bean in java.

  1. Session Bean
  2. Message Driven Bean
  3. Entity Bean

214) What is session bean?
Ans: Session Bean encapsulates business logic. It can be invoked by local, remote or web service client.

There are 3 types of session bean.
  • Stateless Session Bean
  • Stateful Session Bean
  • Singleton Session Bean

215) What is stateless session bean?
Ans: Stateless session bean is a business object that doesn't maintain conversational state with the client.

216) What is stateful session bean?
Ans: Stateful session bean is a business object that maintains conversational state with the client.

217) What is singleton session bean?
Ans: Singleton session bean is instantiated only once for the application. It exists for the life cycle of the application.

218) What is JMS?
Ans: Java Message Service is a messaging service to create, send and receive messages asynchronously.

219) What are the advantages of JMS?
  • Asynchronous
  • Reliable

220) What is PTP model?
Ans: In Point to Point model, one message is delivered to one receiver only. Here, Queue is used as a message oriented middleware.

«« Previous
Next »»