2015 Enterprise Architecture Scheme
2015 Enterprise Architecture Scheme
QUESTION 01
I. State three different computing paradigms currently known in the software industry.
[03 Marks]
[1*3 Marks]
a. Imperative Computing
b. Procedural computing
c. Structured computing
d. Event Driven Computing
e. Object Oriented Computing
f. Service Oriented Computing
III. List down the key characteristics of Service Oriented architecture [04 Marks]
[1 * 4 Marks]
o Great interoperability
o Reduces cost
o Loosely coupled
o Increased reusability
o Ease of integration
o Higher quality of service
IV. Differentiate between SOA and Web service [04 Marks]
Web services are used to build applications that can send/receive messages using SOAP over
HTTP. A web service is a publicized package of functionality offered over the web.
SOA is a set of architectural concepts used for the development and integration of services.
Web services can be used to implement SOA. But it is only a single method of realizing SOA
based applications.
QUESTION 02
Class.forName("com.mysql.jdbc.Driver").newInstance();
d. III. Insert one data record to book table. (02 marks) (Any valid code)
4792132405964);
Book");
while (results.next()) {
intno_page= results.getInt("no_page");
intbook_price= results.getInt("price");
i. }
stmt.close();
connection.close();
QUESTION 03
I. What is “Servlet”? [02 Marks]
Model Answer [2 Marks]
A servlet is a Java programming language class used to extend the capabilities of servers
that host applications accessed via a request-response programming model. Although
servlets can respond to any type of request, they are commonly used to extend the applications
hosted by Web servers. For such applications, Java Servlet technology defines HTTP-specific
servlet classes.
II. What do you mean by Servlet Container? List common tasks performed by Servlet
Container. [04 Marks]
Model Answer [2 Marks]
Servlets run inside a special container called the servlet container as part of the same
process as the web server itself. It is an application server that provides the facilities for
The servlet container is responsible for initializing, invoking, and destroying each servlet
instance.
● Invoking the service method of the servlet, passing the request and response objects.
● Communication Support.
● Multithreading Support
● JSP Support
● Miscellaneous Task: Servlet container manages the resource pool, perform memory
support for multiple applications, hot deployment and several other tasks behind the
IV. Briefly describe the term “Session management in servlet”. What are the different
methods of session management in servlets?
[06 Marks]
Session is a conversional state between client and server and it can consists of multiple
request and response between client and server. Since HTTP and Web Server both are stateless,
the only way to maintain a session is when some unique information about the session (session id)
a. User Authentication
c. Cookies
d. URL Rewriting
Write the code for java Servlet which collect the request and display user name.
[06 Marks]
Model Answer
import java.io.*;
importjavax.servlet.*; 01 Mark
importjavax.servlet.http.*;
02 Marks
IOException
res.setContentType("text/html");
PrintWriter out=res.getWriter();
out.println("<HTML>");
out.println("<HEAD><TITLE>--------</TITLE></HEAD>");
out.println("<BODY>"); 02 Marks
out.println("<BIG>txtUser</BIG>");
out.println("</BODY>");
out.println("</HTML>");
QUESTION 04
I. Briefly explain the advantages of using JSP over Servlets in web application
development? [Marks 04]
At its most basic, JSP allows for the direct insertion of servlet code into an otherwise static HTML file
Any java syntax is valid within these scriptlet tags
Comment : give marks for any suitable answer
II. What is difference between GET and POST method in HTTP protocol? In which
situation does we use doPOST() then? [04 Marks]
GET Retrieves information identified by a request Uniform Resource Identifier (URI)
POST Requests that the server pass the body of the request to the resource identified by
the request URI for processing.
III. Consider the following index.html file which take user name and password
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form method="post" action="Valiate.jsp">
User Name <input type="text" name="txtUser" ><br>
Password <input type="text" name="txtPwd" ><br>
<input type="submit" value="submit"><br>
</form>
</body>
</html>
JSP Page
a. Write a JSP code to get the user name and password through request object at the
server side [ 2 marks ]
<%
String strUsername = request.getParameter("txtUser");
String strPassword = request.getParameter("txtPwd");
%>
b. Write a JSP code to check the user name and password are blank or not
[ 02 marks ]
<%
if (strUsername == null || strPassword == null)
{
out.print("Blank user name or passeord ");
}
%>
c. Write a JSP code to check the user name = ‘admin’ and password =’abc@123’
[ 2 marks ]
<%
If (strUsername.trim().equals("admin") && password. trim().equals("abc@123"))
{
out.println("Welcome ");
}
else
{
out.println("Invalid username and password");
}
%>
IV. Briefly describe the three types of Enterprise Java Beans. [06 Marks]
[2 * 3 Marks]
Session beans
Session beans implement business logic. A session bean instance serves one client at a time.
There are three types of session beans: stateful, stateless, and singleton.
Message-Driven Beans
Entity Bean
QUESTION 05
I. What are the major the differences between XML and HTML [02 Marks]
XML was designed to store and transport data, HTML was designed to display data
III. Briefly explain the term “XML Parser”. Give 2 examples for Java XML parsers.
[04 Marks]
A parser is a program that reads a document , checks whether it is syntactically correct, and
takes some actions as it processes the document.
Java Parsers
• DOM
– Sun JAXP
– IBM XML4J
– Apache Xerces
– Resin (Caucho)
– DXP (DataChannel)
• SAX
– Sun JAXP
– SAXON
• JDOM
V.
a. Write XML code that describes the given scenario.
The root element is Vehicles. The VEHICLE element must contain one each
of items MODEL, REGNO, COLOR, and BRAND in order. The VEHICLE
element may contain an attribute called "transmission type" which may have a
value of "Auto" or "Manual". The elements MODEL, REGNO, COLOR, and
BRAND all contain PCDATA which is parsed character data.
Note: Vehicle may have multiple colors
[05 Marks]
<VEHICLES>
<MODEL>Corolla</ MODEL>
<BRAND>Toyota</ BRAND>
</ VEHICLE>
<BRAND>Nissan</ BRAND>
</ VEHICLE>
</VEHICLES>
b. Design the DTD file for the above XML document. [05 Marks]
ANSWER
<!DOCTYPE VEHICLES [
<!ELEMENTVEHICLES (VEHICLE*)>
<!ATTLISTVEHICLE
<!ELEMENTMODEL (#PCDATA)>
<!ELEMENTREGNO (#PCDATA)>
<!ELEMENTCOLOR (#PCDATA)>
<!ELEMENTBRAND (#PCDATA)>
]>
QUESTION 06
common tasks of the domain as well as a built-in architectural solution that can be easily
III. Why do you use frameworks in web application development? [04 Marks]
any suitable answer
IV. Briefly explain any two frameworks given below. Indicate at least two benefits of
each. [2*4=08 Marks]
A. Spring
B. Struts 2
C. Hibernate
a. Spring
Spring framework is an open source Java platform. Spring is the most popular application
development framework for enterprise Java. Millions of developers around the world use Spring
Framework to create high performing, easily testable, reusable code. Spring is lightweight when it
comes to size and transparency. Spring framework targets to make J2EE development easier to use
Benefits
● Works on POJOs. Hence easier for dependency injection / injection of test data.
● With the Dependency Injection(DI) approach, dependencies are explicit and evident in
● Flexible use of Dependency injection. Can be configured by XML based schema or annotation-
based style.
a. Struts 2
Apache Struts 2 is an open-source web application framework for developing Java EE web
applications.
Struts is a framework based on set of Java technologies like Servlet, JSP, JSTL, XML etc
ready to use validation framework. The power of Struts lies in its model layer by
which Struts can be integrated with other Java technologies like JDBC, EJB, Spring,
Hibernate and many more. Struts is an open source framework developed by Apache
Software foundation.
Benefits
Simplified Design: Code is not tightly coupled to Struts framework or Servlet API.
Easy plug-in: Developers can use other technologies plug-in easily. It includes SiteMesh, Spring,
Tiles, etc.
Simplified ActionForm: ActionForms are POJOs, we do not need to implement any interface or
Annotations introduced: Use of annotation results in reduction in length and complexity of code.
Better tag features: It includes theme based tags and Ajax enabled tags.
Simplified Testability: Unit testing of Struts 2 Action class is very easy because it doesn’t need
Simplified Action: Similar to ActionForms, Actions are also simple POJOs and they do not need
OGNL integration: It uses OGNL to fetch data from ValueStack and type conversion which
reduces code.
Multiple View options: View is not restricted to JSP. Freemarker, velocity templates can also be
used as a view.
a. Hibernate
Hibernate ORM (Hibernate in short) is an object-relational mapping framework for the Java
(and from Java data types to SQL data types), but also provides data query and retrieval facilities.
Hibernate sits between traditional Java objects and database server to handle all the work in
persisting those objects based on the appropriate O/R mechanisms and patterns.
Benefits
● Hibernate takes care of mapping Java classes to database tables using XML files and without
● Provides simple APIs for storing and retrieving Java objects directly to and from the
database.
● If there is change in Database or in any table then the only need to change XML file
properties.
● Abstract away the unfamiliar SQL types and provide us to work around familiar Java
Objects.
a.