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
-
Using the <jsp:readParam/> action
-
Using the <jsp:getParam/> action
-
Use the request.getParameter() method
-
Use the response.getParameter() method
C
Correct answer
Explanation
Parameters passed via within a action become standard request parameters in the included page. The included page accesses these using the familiar request.getParameter() method, just like parameters from an HTML form or URL query string.
-
<jsp:synchronize name="BeanName" />
-
<jsp:setProperty name="BeanName" property="" />
-
<jsp:setProperty name="BeanName" property="*" />
-
<jsp:setProperty name="BeanName" property="All" />
C
Correct answer
Explanation
Using property="*" in automatically matches all request parameter names to bean property names. If the form has fields named firstName and lastName, and the bean has properties with the same names, they're populated automatically. This is a convenient shortcut for form-to-bean synchronization.
-
web.xml
-
servlet.mappings
-
servlet.xml
-
Servlet.java
A
Correct answer
Explanation
The web.xml file is the standard deployment descriptor for Java web applications. It contains servlet mappings, servlet definitions, and other configuration elements. Servlet.mappings and servlet.xml are not standard files.
-
True
-
False
-
Can't say
-
None of these
A
Correct answer
Explanation
Servlets and JSP are widely adopted Java technologies for web development. All major application servers (Tomcat, WebSphere, WebLogic, JBoss) and web servers (Apache with modules, IIS) support them either natively or through plugins.
-
java.servlet
-
javax.servlet
-
.servlet
-
All are same
B
Correct answer
Explanation
To solve this question, the user needs to know about the Java Servlets API and its interface.
The correct answer is:
B. javax.servlet
Explanation:
All the servlets must implement the Servlet interface of the javax.servlet package. The javax.servlet package contains a number of interfaces and classes that define the contracts between a servlet class and the runtime environment provided for an instance of such a class by a conforming servlet container. The javax.servlet package provides the base classes for defining HTTP servlets. Thus option B is correct.
Option A is incorrect because there is no package named java.servlet.
Option C is incorrect because the option is incomplete and doesn't provide the package name.
Option D is incorrect because there is only one correct option, and that is option B.
Therefore, the answer is: B. javax.servlet
-
True
-
False
-
Not always
-
None of these
B
Correct answer
Explanation
HTTP GET and POST are defined from the client's perspective. GET requests data FROM a server, POST sends data TO a server. The statement reverses this - it claims GET gets from a client (wrong) and POST posts to a client (wrong).
-
HttpServletResponce
-
HttpRequest
-
ServletRequest
-
HttpServletRequest
D
Correct answer
Explanation
The servlet container creates an HttpServletRequest object representing the client request and passes it to the service() method (which then delegates to doGet(), doPost(), etc.). This object contains request metadata, parameters, headers, and session info.
-
CLIENT
-
SERVER
-
INTERNET
-
IN LOCAL PC
B
Correct answer
Explanation
Servlets run within a servlet container or web server (like Tomcat). The client (browser) cannot directly access servlet code - it makes HTTP requests to the server, which executes the servlet and returns the response.
-
Make the information available from a singleton
-
Store the information in the ServletContext
-
Store the information in an HttpSession
-
Store the information in a Properties file
-
Cookies
-
URL rewriting
-
HttpSessions
-
Hidden tags
C
Correct answer
Explanation
HttpSession stores state on the server side, making it independent of client browser settings. The session ID can be transmitted via cookies or URL rewriting as a fallback, ensuring reliable state management.
-
They are instantiated every time a request is made
-
They are a mechanism used by the class loader to download applets
-
They can be used instead of CGI scripts
-
They require a web browser that supports JDK 1.1
B
Correct answer
Explanation
Servlets are server-side Java programs that extend server capabilities, typically running in a web container with a single instance handling multiple requests via threading (not reinstantiated per request). They can replace CGI scripts for generating dynamic web content and run entirely on the server, so client browser JDK support is irrelevant. The statement about class loaders downloading applets is unrelated to servlets - that describes applet mechanisms, not servlet technology.
-
Client side program
-
Server side program
-
Both are true
-
None of these
B
Correct answer
Explanation
A servlet is a Java program that runs on a server side, typically within a web container. It handles client requests and generates dynamic responses, extending the server's capabilities. Servlets are not client-side programs (like JavaScript), and the question asks for a binary choice between client and server side.
-
Persistent Objects
-
Database Tables
-
Only a
-
Both a & b
B
Correct answer
Explanation
Hibernate is an ORM (Object-Relational Mapping) framework that maps Java classes (persistent objects) to database tables. The mapping allows Java objects to be persisted to and retrieved from a relational database without writing SQL. Option C is garbled and should read 'Only A'. Option D is incorrect because it's not 'both' - the tables are the destination, not a parallel mapping.
-
persistent objects
-
database tables
-
only a
-
both a & b
B
Correct answer
Explanation
Hibernate ORM (Object-Relational Mapping) maps Java classes to database tables, and Java data types to SQL data types. The mapping allows developers to work with objects in Java while Hibernate handles the underlying database operations.
-
utility classes
-
Pojo
-
both 1 & 2
-
none
B
Correct answer
Explanation
Hibernate uses POJO (Plain Old Java Objects) classes for mapping Java objects to database tables. The mapping is typically done through XML mapping files or Java annotations on POJO classes. Utility classes are not the primary mapping mechanism in Hibernate.