Computer Knowledge

Java Enterprise and Web Technologies

2,279 Questions

Java enterprise and web technologies questions focus on J2EE architecture, web services like SOAP, and servlet functionalities. These topics frequently appear in IT officer and specialist scale examinations. Regular practice ensures familiarity with enterprise application components.

HttpServlet methodsSOAP and web servicesEJB architecture rolesJ2EE componentsJSP servlet callingUDDI concepts

Java Enterprise and Web Technologies Questions

Multiple choice technology programming languages
  1. You cannot write JDBC code in the bean class to make a connection and send queries to any database.

  2. You cannot write JDBC code in the bean class to change the values of virtual persistent fields of your bean.

  3. You can write JDBC code and get connected to any database you want.

  4. You can write JDBC code to read the virtual persistent fields, but you cannot change their values.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In Container-Managed Persistence (CMP), persistent fields are virtual and accessed via abstract getter and setter methods. The container manages their database synchronization, so you cannot write direct JDBC code to modify these virtual fields. While JDBC can be used for other database connections, direct manipulation of CMP-managed fields is strictly prohibited.

Multiple choice technology programming languages
  1. getEJBObject()

  2. getPrimaryKey()

  3. getEJBHome()

  4. getRollbackOnly()

  5. getUserTransaction()

Reveal answer Fill a bubble to check yourself
A,B,C,D Correct answer
Explanation

During ejbPostCreate, the entity bean's identity is fully established, meaning getEJBObject() and getPrimaryKey() can be safely called. getEJBHome() and transaction methods like getRollbackOnly() are also accessible. However, getUserTransaction() is invalid because entity beans must use container-managed transactions (CMT) and cannot use bean-managed transactions.

Multiple choice technology programming languages
  1. All entity bean instances of the same type (say CustomerBean) have the same Home, that is, an instance of an object that implements the home interface of this bean.

  2. A specific entity bean instance can be accessed by only one client at a time.

  3. If two clients wanted to access the same entity in the database concurrently, the container would make two entity bean instances to represent that entity.

  4. If two clients wanted to access the same entity in the database concurrently, the container would make one entity bean to represent that entity, and the two clients would get their own references to the same EJBObject correspondtwo clients would get their

Reveal answer Fill a bubble to check yourself
A,D Correct answer
Explanation

All entity bean instances of the same type share the same Home object - this is a fundamental EJB design. When multiple clients access the same entity concurrently, the container doesn't create multiple bean instances (Option C is wrong). Instead, it creates multiple EJBObject references pointing to the same bean instance. This allows concurrent access while maintaining the single-entity representation.

Multiple choice technology programming languages
  1. ejbCreate<method>

  2. Home business methods

  3. Business methods exposed in the component interface

  4. ejbStore()

  5. None of the above

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

The getUserTransaction() method from EntityContext can ONLY be called from business methods in the component interface, and only for bean-managed transaction (BMT) entity beans. It cannot be called from ejbCreate, ejbStore, or home business methods - these methods have specific transaction context restrictions. Entity beans with container-managed transactions (CMT) cannot use getUserTransaction() at all.

Multiple choice technology programming languages
  1. Servlet in web application

  2. Record in a database

  3. Enterprise java bean

  4. File record

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

JPD (Java Process Definition) components in WebLogic are deployed as Enterprise Java Beans (EJBs), which is the standard enterprise-level deployment model for business logic components in Java EE application servers. Servlets run in web containers, not as standalone deployment units. Records and file records are database or file system concepts, not deployment artifacts.

Multiple choice technology web technology
  1. Client UI component, Bean management, Client-side validation and Maintaining cookies

  2. UI components,Handling events, Server-side validation, Data conversion, and Page navigation

  3. It does not have any components, it is just a framework

  4. Web container, Bean container, EIS container

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

JSF is a component-based framework where UI components are the core building blocks. The framework handles events (like button clicks), performs server-side validation, converts data between view and model, and manages page navigation. Option A incorrectly mentions client-side validation and cookies, which are not core JSF concerns.

Multiple choice technology web technology
  1. Page authors, Application developers, Component writers, Application architects, and Tools vendors

  2. Pagination, Event handling, Server-side validation and event handler

  3. Business component, web component, Bean component and Client component

  4. None of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The JSF framework involves page authors, application developers, component writers, architects, and tool vendors; these roles collectively define, build, and maintain JSF applications. The other options list activities or component types rather than stakeholder roles, making them incorrect.

Multiple choice technology web technology
  1. Request Scope, Session Scope, Application Scope

  2. Request Scope, Session Scope, Application Scope, Page Scope

  3. Request Scope, Session Scope, Application Scope, Page Scope, Response Scope

  4. Response Scope, Session Scope, Application Scope

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

JSF beans have scoped lifecycles: Request (per HTTP request), Session (per user session), Application (singleton per app), and View (per JSF view, added in JSF 2.0). Option A lists the classic three scopes. Response scope does NOT exist in JSF - this is likely confusion with other frameworks.

Multiple choice technology web technology
  1. It is a database server for communication with the web applications

  2. It is a server-side user interface component framework for Java technology-based web applications

  3. It is a server-side script for accessing database

  4. It is a client-side user interface component developed,using javascript and xml

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

JavaServer Faces (JSF) is a server-side UI component framework for building Java web applications. It provides reusable UI components, handles event processing, manages state, and separates presentation from business logic. It is NOT a database server, client-side framework, or script.

Multiple choice technology web technology
  1. The requested resource has been found under a different URI but the client should continue to use the original URI.

  2. Reserved for future use.

  3. The request was successful and a new resource was created.

  4. The syntax of the request was not understood by the server.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

HTTP 302 Found indicates a temporary redirect to a different URI. Unlike 301 (permanent redirect), clients should continue using the original URI for future requests because the redirect location may change again.

Multiple choice technology programming languages
  1. myapp/WEB-INF/public_html

  2. myapp/WEB-INF/classes

  3. myapp/WEB-INF

  4. myapp/WEB-INF/lib

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The WEB-INF directory contains the deployment descriptor (web.xml) and other protected files that should not be directly accessed by clients. The WEB-INF/classes directory holds compiled Java classes, WEB-INF/lib contains JAR libraries, and public_html is not a standard WEB-INF subdirectory.

Multiple choice technology programming languages
  1. Using getRequestDispatcher() method of RequestDispatcher interface

  2. Using getRequestDispatcher() method of ServletContext interface

  3. Using getDispatcher() method of RequestDispatcher interface

  4. Using getDispatcher() method of ServletContext interface

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The RequestDispatcher object is obtained using the getRequestDispatcher() method of the ServletContext interface, not the RequestDispatcher interface itself. This is because ServletContext provides the context for resource dispatching within the web application.