Computer Knowledge

Java Enterprise and Web Technologies

2,183 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 web technology
  1. in an online exchange between several open source developers

  2. over a long holiday weekend

  3. as a commercial package

  4. none

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

According to Struts history, the framework was first developed over a long holiday weekend by Craig R. McClanahan. This is the well-known origin story of the Apache Struts framework.

Multiple choice technology web technology
  1. Bypass calls to the ActionForm validate method

  2. Bypass validation of the Struts configuration file

  3. Generate an error message if an unknown message key is used

  4. none

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

The validating init-param of ActionServlet, when set to false, bypasses validation of the Struts configuration file (struts-config.xml). It does not affect ActionForm validation.

Multiple choice technology web technology
  1. Use an asterisk for the path property

  2. Set the "default" property of the mapping to "true"

  3. Set the "unknown" property of the mapping to "true"

  4. Set the "missing" init-param of the ActionServlet to the mapping's path

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

To specify a default ActionMapping for unmatched requests, you set the unknown property to true. This creates a catch-all mapping that handles any request path not explicitly defined.

Multiple choice technology web technology
  1. Overriding the populate method of the ActionForm

  2. Overriding the processPopulate method of the Request Processor

  3. Overriding the populateBean method of the ActionMapping

  4. None

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

In Struts 1.1, the RequestProcessor class contains the processPopulate method that handles form population. Overriding this method allows customization of how request parameters populate ActionForm beans. ActionForm does not have a populate method, and ActionMapping is not involved in population.

Multiple choice technology programming languages
  1. itemID(int itemId)

  2. update(int itemId)

  3. setItemId(int itemId)

  4. mutateItemId(int itemId)

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

To solve this question, the user needs to understand the naming conventions used in JavaBeans to create setter methods for private instance variables.

According to JavaBeans conventions, setter methods for private instance variables should be named in the format setVariableName. Therefore, the correct method signature to modify the itemId instance variable in the Inventoryltem class should be:

C. setItemId(int itemId)

Option A: itemID(int itemId) is not following the JavaBeans naming standards for setter methods. The method name should start with the prefix set followed by the variable name.

Option B: update(int itemId) does not follow the JavaBeans naming conventions. The method name should start with the prefix set followed by the variable name.

Option D: mutateItemId(int itemId) is not a standard JavaBeans naming convention. The method name should start with the prefix set followed by the variable name.

Therefore, the correct answer is:

The Answer is: C. setItemId(int itemId)

Multiple choice technology web technology
  1. Yes,always.Spring framework will understand automatically when it will not find applicationcontext.xml

  2. No,never this can happen

  3. Yes,by specifying a <context-param> element named “contextConfigLocation" for the listener class "org.springframework.web.context.ContextLoaderListener"

  4. Yes,if we use it with JSF

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

You can use any custom XML configuration file name instead of applicationContext.xml by defining the contextConfigLocation parameter in web.xml for the ContextLoaderListener.

Multiple choice technology web technology
  1. singleton

  2. prototype

  3. global session

  4. response

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

Spring Framework has five standard bean scopes: singleton (default), prototype, request, session, and global session. 'response' is not a valid Spring bean scope. The other three options listed are all valid scopes (singleton and prototype are the most commonly used).

Multiple choice technology web technology
  1. XmlWebApplicationContext

  2. RequestXmlApplicationContext

  3. ClassPathXmlApplicationContext

  4. FileSystemXmlApplicationContext

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

Spring provides XmlWebApplicationContext, ClassPathXmlApplicationContext, and FileSystemXmlApplicationContext. There is no standard class named RequestXmlApplicationContext in the Spring Framework.

Multiple choice technology web technology
  1. Global Scope

  2. Application Scope

  3. Session Scope

  4. Request Scope

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

JSF (JavaServer Faces) has several built-in scopes: Request Scope, View Scope, Session Scope, and Application Scope. These scopes manage the lifecycle of managed beans. Global Scope is not a standard JSF scope, making option A the correct answer to what is NOT a valid scope.

Multiple choice technology web technology
  1. FacesContext.getCurrentInstance().getViewRoot()

  2. FacesContext.getCurrentInstance().responseComplete()

  3. FacesContext.getCurrentInstance().renderResponse()

  4. FacesContext.getCurrentInstance().release()

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

The renderResponse() method on FacesContext tells JSF to skip to the Render Response phase of the lifecycle, effectively causing the page to be redisplayed. This is commonly used in value change listeners when you want to update the UI after a value change.

Multiple choice technology web technology
  1. Setter Injection

  2. Method Injection

  3. Constructor injection

  4. Interface Injection

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

Spring supports two main types of dependency injection: Setter Injection (A) and Constructor Injection (C). Method Injection (B) and Interface Injection (D) are not standard DI types in Spring. Spring's IoC container primarily uses setter and constructor injection patterns.

Multiple choice technology web technology
  1. Yes,always.Spring framework will understand automatically when it will not find applicationcontext.xml

  2. No,never this can happen

  3. Yes,by specifying a <context-param> element named “contextConfigLocation" for the listener class "org.springframework.web.context.ContextLoaderListener"

  4. Yes,if we use it with JSF

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

Spring allows custom XML configuration files by specifying the contextConfigLocation context parameter. The ContextLoaderListener loads the specified files instead of the default applicationcontext.xml. Option A is wrong because Spring doesn't automatically find other files. Option B is wrong because it's possible. Option D is irrelevant to Spring.

Multiple choice technology web technology
  1. XmlWebApplicationContext

  2. RequestXmlApplicationContext

  3. ClassPathXmlApplicationContext

  4. FileSystemXmlApplicationContext

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

Spring's common ApplicationContext implementations include ClassPathXmlApplicationContext, FileSystemXmlApplicationContext, and XmlWebApplicationContext. 'RequestXmlApplicationContext' is not a real implementation - this is likely mixing up the concept of request scope beans with ApplicationContext types.