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
-
response.setparameter () method
-
response.getparameter () method
-
request.setparameter () method
-
request.getparameter () method
D
Correct answer
Explanation
To retrieve values from an HTML form, use request.getParameter() on the HttpServletRequest object. There is no setParameter() method on request, and response is for sending data back to the client, not receiving it.
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.
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.
-
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.
-
ServletRequestAware
-
ServletResponseAware
-
ActionSupport
-
All of them
A
Correct answer
Explanation
To receive the HttpServletRequest instance in a Struts 2 Action class, you implement the ServletRequestAware interface. This interface's setServletRequest(HttpServletRequest) method is called by Struts 2 before the action executes, injecting the request object. ServletResponseAware is for responses, ActionSupport is a convenience base class.
A
Correct answer
Explanation
Action classes in Struts 2 are instantiated on a per-request basis by default. Each request creates a new instance of the action class, which makes actions thread-safe and stateless. This is a key difference from some frameworks where actions might be singletons. The Struts 2 interceptor stack and valueStack work with this per-request instance model.