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
B
Correct answer
Explanation
Static variables are shared only within a single JVM instance. Each server runs its own JVM with its own memory space, so static variables are not shared across different servers. Each servlet instance on each server has its own separate copy of the static variable.
-
HTTPRequest.setUserName()
-
HttpServletRequest.getUserName()
-
HTTPResponse.setUserName()
-
HTTPResponse.getUserName()
B
Correct answer
Explanation
In Java Servlets, user authentication information is accessed through the HttpServletRequest object using getRemoteUser() for basic authentication or getUserPrincipal() for form-based authentication. The HttpServletRequest interface provides methods to retrieve authentication data, not HTTPRequest, HTTPResponse, or setUserName methods.
-
Action
-
ActionServlet
-
HttpServlet
-
Servlet
-
None of the above
A,B
Correct answer
Explanation
Action classes contain the business logic and handle request processing in Struts. ActionServlet is the main controller servlet that receives all requests and routes them to appropriate Action classes. HttpServlet is the base servlet class but not specific to Struts, and Servlet is too generic.
-
web.xml
-
validator-rules.xml
-
struts-config.xml
-
application.xml
C
Correct answer
Explanation
The struts-config.xml file is the default configuration file in Struts framework. It defines action mappings, form beans, forwards, and other framework configurations. web.xml is for general servlet configuration, validator-rules.xml is for validation rules, and application.xml is for J2EE applications.
-
ServiceInstance
-
SystemSubjectArea
-
DashboardBeforeMenu
-
Java_Home
B
Correct answer
Explanation
SystemSubjectArea is a valid tag in instanceconfig.xml used for configuring system-level subject areas in OBIEE/OBIS. The other options are either invalid tags or belong to different configuration files.
-
sfController
-
sfRequest
-
sfResponse
-
sfConcept
D
Correct answer
Explanation
Symfony (specifically Symfony 1.x legacy core classes) utilizes sfController to handle execution flow, sfRequest to represent the HTTP request, and sfResponse to represent the HTTP response. sfConcept is not a class or core component in the Symfony framework.
-
A presentation technology
-
A technology for specifying business rules
-
A persistence technology
-
None of the above
A
Correct answer
Explanation
The claimed answer is A. JSF (JavaServer Faces) is primarily a presentation technology for building user interfaces in Java web applications. It is not a business rules specification technology (Option B) or a persistence technology (Option C). JSF handles the presentation layer through UI components and managed beans.
-
There will be an server error.
-
We will stay on the same page.
-
We will land on the login Page.
-
There is no h:commandLink tag.
-
We will land on the powerRangers Page.
B
Correct answer
Explanation
The outcome returned by the link is 'hugo', which does not match any of the defined `` cases ('Hello' or 'Turtle') in the navigation rule. In JSF, if no navigation case matches the returned outcome, the navigation handler keeps the user on the current page.
B
Correct answer
Explanation
The claimed answer is False (B). JSF navigation rules using do not support EL expressions in the view path. Navigation rules are static configuration defined in faces-config.xml, and EL expressions like #{myBean.id} cannot be used directly in the tag. Dynamic navigation with parameters would be handled differently in the action method or through other mechanisms.
-
Throws an exception.
-
Executes the action method and throws an exception.
-
Executes the action method and renders current view.
-
Controller will be in the same page
C
Correct answer
Explanation
The claimed answer is C. When a commandLink or commandButton action method returns null, JSF executes the action method but then re-renders the current view instead of navigating to a different page. Option A and B are incorrect because no exception is thrown. Option D is misleading - it's not just 'same page', it's explicitly re-rendering the current view after action execution.
A
Correct answer
Explanation
In JSF (JavaServer Faces) navigation rules, specifying and without a is perfectly legal. When is omitted, any outcome returned by the specified action method will match the rule and trigger the navigation.
A
Correct answer
Explanation
JSF provides built-in standard error messages for conversion and validation failures. These messages are automatically displayed in h:messages or h:message tags when conversion or validation errors occur, though they can be customized via message bundles.
A
Correct answer
Explanation
The processDecodesWithoutValidation method in JSF does exactly what its name suggests: it executes the Apply Request Values phase and decodes parameters without running validation. This is useful for scenarios where you want to process submitted data but skip validation logic. The method will handle RuntimeExceptions appropriately, but its key characteristic is bypassing the validation phase for immediate components.
-
Servlet
-
Servlet Filter
-
JSP
-
None of The Above
B
Correct answer
Explanation
In Struts 2, the first entry point in the request processing lifecycle is a Servlet Filter (FilterDispatcher or StrutsPrepareAndExecuteFilter). This filter intercepts all requests and dispatches them to the appropriate action. This is different from Struts 1 which used a central ActionServlet.
-
Unchecked
-
Checked
-
All of the Above
-
None of the Above
A
Correct answer
Explanation
The Struts 2 exception handling mechanism primarily handles unchecked exceptions (RuntimeException and its subclasses). Checked exceptions need to be caught and handled by the application code or wrapped in runtime exceptions. The exception mapping in struts.xml works with unchecked exceptions.