Web Technology Suggestions
Web Technology Suggestions
Web Technology Suggestions
Ans:
a. SOAP: Simple Object Access Protocol
b. RMI: Remote Method Invocation
c. JNI: Java Native Interface
d. JINI: Java Intelligent Network Infrastructure
e. JNDI: Java Naming and Directory Interface API
f. EJB: Enterprise Java Beans
• Easier maintenance: A content management system that has the database for
all elements, is used for dynamic websites. They also use scripting languages
that primarily interact with all the database’s information, making it possible
to execute site-wide changes without needing to do changes one by one.
Page |3
• Futuristic: Dynamic websites empower the user to be more involved & engage
with the content of the site. By offering them an interactive and responsive
experience, they elevate them through personalized browsing.
4. What is CGI?
Ans: The common gateway interface (CGI) is a standard way for a Web server to pass
a Web user's request to an application program and to receive data back to forward
to the user. When the user requests a Web page (for example, by clicking on a
highlighted word or entering a Web site address), the server sends back the
requested page. However, when a user fills out a form on a Web page and sends it in,
it usually needs to be processed by an application program. The Web server typically
passes the form information to a small application program that processes the data
and may send back a confirmation message. This method or convention for passing
data back and forth between the server and the application is called the common
gateway interface (CGI). It is part of the Web's Hypertext Transfer Protocol (HTTP).
The common gateway interface provides a consistent way for data to be passed from
the user's request to the application program and back to the user. This means that
the person who writes the application program can makes sure it gets used no
matter which operating system the server uses
It's simply a basic way for information to be passed from the Web server about your
request to the application program and back again.
Because the interface is consistent, a programmer can write a CGI application in a
number of different languages. The most popular languages for CGI applications are:
C, C++, Java and PERL.
Features of CGI:
• It is a very well-defined supported standard.
• CGI scripts are generally written in either Perl, C, or maybe just a simple shell
script/
• CGI is a technology that interfaces with HTML.
Page |4
5. Write down the advantages of 3 tier architecture over 2 tier architecture of J2EE.
Ans:
Ans: Following are the advantages of 3 tier architecture.
• It is scalable as each tier can scale in horizontal direction.
• Better re-use is possible.
• Offers higher flexibility as far as configuration and platform deployment is
concerned.
• It improves data integrity.
• It offers higher level of security as client does not have access to the database
directly.
• It is easier to maintain and do any modification.
• Offers good performance as presentation tier does caching operations. This offers
better network utilization and load is reduced on application tier and data tiers.
6. Write down the Servlet Life Cycle. What is the function of init(), service() and
destroy() method in the cycle of Servlet.
Ans: A servlet life cycle can be defined as the entire process from its creation till the
destruction.
The following are the paths followed by a servlet:
• The servlet is initialized by calling the init() method.
• The servlet calls service() method to process a client’s request.
• The servlet is terminated by calling the destroy() method.
• Finally, servlet is garbage collected by the garbage collector of the JVM.
• The servlet is normally created when a user first involves a URL corresponding
to the servlet, but we can also specify that the servlet be loaded when the
server is first started.
• When a user invokes a servlet, a single instance of each servlet gets created,
with each user request resulting in a new thread that is handled off to doGet
or doPost as appropriate.
• The init() method simply creates or loads some data that will be used
throughout the life of the servlet.
• Example:
public void init() throws ServletException {
// initialization code
}
// finalization code…
}
7. Differentiate between:
a. Cookies and Session
b. GET() and POST() method
c. CGI and Servlet
d. Servlet and Applet
e.
Ans:
a. Cookies and Session
Cookies Sessions
Cookies are the client-side files that Sessions are server-side files that
are stored on a local computer and store user information.
contain user information.
Cookies expire after the user The session ends when the user
specified lifetime. closes the browser or logs out of the
program.
It can only store a limited amount of It is able to store an unlimited
data. amount of information.
Cookies can only store upto a There is a maximum memory
maximum of 4 kB of data in a restriction of 128 mB that a script
browser. may consume at one time. However,
we are free to maintain as much
data as we like within a session.
It is necessary for us to execute a Utilizing the session start() method is
function in order to get cookies required before we can begin the
going because they are stored on the session.
local computer.
Cookies are used to store The data is saved in an encrypted
information in a text file. format during sessions.
Cookies are stored on a limited A session can store an unlimited
amount of data. amount of data.
e. D
Ans:
a. J2EE Architecture:
J2EE stands for Java 2 Platform, Enterprise Edition. J2EE is the standard
platform for developing applications in the enterprise and is designed for
enterprise applications that run on servers. J2EE provides APIs that let
developers create workflows and make use of resources such as databases or
web services. J2EE consists of a set of APIs. Developers can use these APIs to
build applications for business computing.
A J2EE application server is software that runs applications built with J2EE APIs
and lets us run multiple applications on a single computer. Developers can use
different J2EE application servers to run applications built with J2EE APIs.
Benefits of J2EE:
Page |9
Limitations of J2EE:
• J2EE doesn’t provide any database access services.
• You cannot build desktop applications using J2EE APIs; they only run in
application servers and communicate with backend J2EE services
(application servers).
• Application servers often require separate licenses and must be
purchased separately.
b. WWW:
The World Wide Web is abbreviated as WWW and is commonly known as the
web. WWW can be defined as the collection of different websites around the
world, containing different information shared via local servers (or
computers).
From the user’s point of view, the web consists of a vast, worldwide
connection of documents or web pages. Each page may contain links to other
pages anywhere in the world. The browser fetches the page requested
interprets the text and formatting commands on it, and displays the page,
properly formatted, on the screen.
A Web browser is used to access web pages. Web browsers can be defined as
programs which display text, data, pictures, animation and video on the
Internet. Hyperlinked resources on the World Wide Web can be accessed
P a g e | 10
c. JDBC Drivers:
JDBC Drivers are client-side adapters (installed on the client machine, not on
the server) that convert requests from Java programs to a protocol that the
DBMS can understand.
Type – 1 Driver: or JDBC – ODBC Bridge Driver uses ODBC Driver to connect to
the database. The JDBC – ODBC Bridge Driver converts JDBC method calls into
the ODBC function calls. Type – 1 driver is also called Universal Driver because
it can be used to connect to any of the databases. Type – 1 driver isn’t written
in Java, that’s why it isn’t a portable driver. This driver software is built-in with
JDK so no need to install separately. It is a database independent driver.
Type – 2 Driver: This driver converts JDBC method calls into native calls of the
database API. In order to interact with different database, this driver needs
their local API, that’s why data transfer is much more secure as compared to
type – 1 driver. Driver needs to be installed separately in individual client
P a g e | 11
machines. This driver isn’t written in Java, that’s why it isn’t a portable driver.
It is a database dependent driver.
Type – 4 Driver: is also called Native Protocol Driver. This driver interact with
the database. It does not require any native database library, that is why it is
known as Thin Driver. It does not require any native library and middleware
server, so no client-side or server-side installation.
d. MVC Architecture:
Model View Controller or MVC is a software design pattern for developing
web applications. A Model View Controller pattern is made up of the following
three parts:
• Model: The lowest level of the pattern which is responsible for
maintaining data.
• View: This is responsible for displaying all or a portion of the data to
the user.
• Controller: Software code that controls the interaction between the
Model and View.
The Model is responsible for managing the data of the application. It responds
to the request from the view and it also responds to instructions from the
controller update itself.
The Controller is responsible for responding to the user input and perform
interactions on the data model objects. The controller receives the input, it
validates the input and then performs the business operation that modifies
the state of the data model.
P a g e | 12
9. What is CSS?
Ans: Cascading Style Sheets, fondly referred to as CSS, is a simple design language
intended to simplify the process of making web pages presentable.
CSS handles the look and feel part of a web page.
Using CSS, you can control the color of the text, the style of fonts, the spacing
between paragraphs, how columns are sized and laid out, what background images
or colors are used, layout designs, and variations in display for different devices and
screen sizes as well as a variety of other effects.
Benefits of CSS:
• Improves website presentation
• Makes updates easier and smoother
• Helps web pages load faster.
10. Provide coding example for external, embedded, imported and inline style of
CSS.
Ans:
There are three type of CSS which are given below:
• Inline CSS
• Internal CSS or Embedded CSS
• External CSS
Inline CSS: contains the CSS property in the body section attached with element is
known as inline CSS. This kind of style is specified within an HTML tag using the style
attribute.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Inline CSS</title>
</head>
<body>
<p style = “color: #009900; font-size: 50px;
Font-style: italic; text-align: center;”>
HelloWorld
</p>
</html>
P a g e | 13
Internal or Embedded CSS: This can be used when a single HTML document must me
styles uniquely. The CSS rule set should be within the HTML file in the head section
i.e., the CSS is embedded within the HTML file.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Internal CSS</title>
<style>
.main {
text-align: center;
}
.hello{
color: #009900;
font-size: 50px;
font-weight: bold;
}
.div-container{
font-style: bold;
font-size: 20px;
}
</style>
</head>
<body>
<div class = “main”>
<div class = “hello”>HelloWorld</div>
<div class = “div-container”>
A second div.
</div>
</div>
</body>
</html>
External CSS: contains separate CSS file which contains only style property with the
help of tag attributes (for example; class, id, heading, … etc.). CSS property written in
a separate file with .css extension and should be linked to the HTML document using
link tag. This means that for each element, style can be set only once and that will be
applied across web pages.
P a g e | 14
Example: The file given below contains CSS property. This file is saved with .css
extension. For ex: hello.css
body {
background-color: powderblue;
}
.main {
text-align: center;
}
.hello {
color: #009900;
font-size: 50px;
font-weight: bold;
}
#div-container {
font-style: bold;
font-size: 20px;
}
Below is the HTML file tag that is making use of the created external style sheet
• link tag is used to link the external style sheet with the html webpage.
• href attribute is used to specify the location of the external style sheet file.
<!DOCTYPE html>
<html>
<head>
<link rel = “stylesheet” href = “style.css”/>
</head>
<body>
<div class = “main”>
<div class = “hello”>HelloWorld</div>
<div id = “div-container”>This is a heading.</div>
</div>
</body>
</html>
P a g e | 15
The class selector selects elements with a specific class attribute. It matches all the
HTML elements based on the contents of their class attribute. The . symbol, along
with the class name, is used to select the desired class.
The ID selector matches an element based on the value of its id attribute. In order for
the element to be selected, its ID attribute must exactly match the given value in the
selector. The # symbol and the id of the HTML element name are used to select the
desired element.
The difference between an ID and a class is that an ID is only used to identify one
single element in out HTML. IDs are only used when one element on the page should
have a particular style applied to it, However, a class can be used to identify more
than one HTML element.
Inside the server program, a remote object is created and reference to that object is
made available for the client (using the registry).
The client program requests the remote objects on the server and tries to invoke its
methods.
The JNI allows Java code that runs within a Java Virtual Machine (JVM) to operate
with the applications and libraries written in other languages, such as C, C++, and
assembly. In addition, the Invocation API allows us to embed the Java Virtual
Machine into our native applicatons.
Programmers use the JNI to write native methods to handle those situations when
an application cannot be written entirely in the Java programming language.
For example, we may need to use native methods and the JNI in the following
situations:
• The standard java class library may not support the platform-dependent
features needed by the application.
• We may already have a library or application written in another programming
language and we wish to make it accessible to Java applications.
P a g e | 17
Stateful Session Bean: performs business task with the help of a state. It
can be used to access various method calls by storing the information in an
instance variable. Some of the applications require information to be
stored across separate method calls. In a shopping site, the items chosen
by a customer must be stored as data is an example of stateful session
bean.
• Message Driven Bean: Like session bean, it contains the business logic but it is
invoked by passing message.
• Entity Bean: It summarizes the state that can be remained in the database, it
is deprecated. Now, it is replaced with JPA (Java Persistent API).
15. What is JMS (Java Message Service)? Why it is important in Message Driven EJB
Beans.
Ans: A message driven bean (MDB) is a bean that contains business logic. But, it is
invoked by passing the message. So, it is like JMS Receiver.
A message driven bean receives message from queue or topic, so you must have the
knowledge of JMS API.
JMS (Java Message Service) is an API that provides the facility to create, send and
read messages. It provides loosely coupled, reliable and asynchronous
communication. JMS is also known as a messaging service.
Generally, user sends message to application. But, if we want to send message from
one application to another, we need to use JMS API.
P a g e | 19
However, WebLogic JMS actually distributes the messaging load across all the
available destination members within the distributed destination. In the event that
a member becomes unavailable due to a server failure, traffic is then redirected
toward the other available destination members in the set.
• SOA allows users to combine a large number of facilities from existing services
to form applications.
• SOA encompasses a set of design principles that structure system
development and provide means for integrating components into a coherent
and decentralized system.
• SOA-based computing packages functionalities into a set of interoperable
services, which can be integrated into different software systems belonging to
separate business domains.
• Service consumer: The service consumer can locate the service metadata in
the registry and develop the required client components to bind and use the
service.
17. Design one registration page using name, gender, email, form tag.
Ans:
<!DOCTYPE html>
<html>
<head>
<h1>Registration Form</h1>
</head>
<body>
<form>
<table>
<tr>
<td>Name:</td>
<td><input type = “text” placeholder = “Enter your name:”></td>
</tr>
<tr>
<td>Gender:</td>
P a g e | 21
<tr>
<td>Email Address:</td>
<td><input type = “mail” placeholder = “Enter your email:”></td>
</tr>
</table>
</form>
</body>
</html>
18. How do you hyperlink one web page to another using ‘href’ tag.
Ans: To make page links in an HTML page, use the <a> and </a> tags, which are the
tags used to define the links. The <a> tag indicates where the link starts and the </a>
tag indicates where it ends. Whatever text gets added inside these tags, will work as
a link. Add the URL for the link in the <a href = “” >
Example:
<!DOCTYPE html>
<html>
<body>
<h2>Click on the texts below to open the URLs</h2>
<p><a href = “https://www.google.com”>Google</a></p>
<p><a href = https://www.youtube.com>YouTube</a></p>
</body>
</html>
The <frameset> tag in HTML is used to define the frameset. The <frameset> element
contains one or more frame elements. It is used to specify the number of rows and
P a g e | 22
columns in frameset with their pixel of spaces. Each element can hold a separate
document.
<!DOCTYPE html>
<html>
<head>
</head>
<frameset cols = “20%, 50%, 30%”>
<frame name = “top” src = “red.png”/>
<frame name = “main” src = “yellow.png”/>
<frame name = “bottom” src = “blue.png”/>
<noframes>
<body> The browser you are working does not support frame.</body>
</noframes>
</frameset>
</html>
Ans:
<!DOCTYPE html>
<html>
<body>
<table border="1">
<tr>
<th>NAME</th>
<th>ID</th>
<th>MARKS</th>
</tr>
<tr>
<td>A</td>
<td>10</td>
<td>85</td>
</tr>
P a g e | 23
<tr>
<td>B</td>
<td>20</td>
<td>75</td>
</tr>
<tr>
<td>C</td>
<td>30</td>
<td>65</td>
</tr>
</table>
</body>
</html>
Following diagram shows how XML parser interacts with XML document −
The goal of a parser is to transform XML into a readable code. To ease the process of
parsing, some commercial products are available that facilitate the breakdown of
XML document and yield more reliable results.
DOM (Document Object Model): is an object which contains all the information of
an XML document. It is composed like a tree structure. The DOM parser implements
a DOM API. The API is very simple to use.
Features:
A DOM Parser creates an internal structure in memory which is a DOM document
object and the client applications get information of the original XML document by
invoking methods on this document object.
Advantages:
• It supports both read and write operations and the API is very simple to use.
• It is preferred when random access to widely separated parts of a document is
required.
Disadvantages:
• It is memory inefficient (consumes more memory because the whole XML
document needs to be loaded into memory).
• It is comparatively slower than other parsers.
SAX (Simple API for XML): A SAX Parser implements SAX API. This API is an event-
based API and less intuitive.
Features:
It does not create any internal structure.
Clients does not know what methods to call, they just overrides the methods of the
API and place its own code inside method.
Advantages:
• It is very simple and memory efficient.
• It is very fast and works for huge documents.
Disadvantages:
• It is event-based so its API is less intuitive.
• Clients never know the full information because the data is broken into pieces.
• Header: This part is not mandatory. But when it is present it can provide
crucial information about the applications.
• Fault: This section contains the status of the application and also contains
errors in the application. This section is also optional. It should not appear
more than once in a SOAP message.
Advantages of SOAP:
• SOAP is a light weight data interchange protocol because it is based on XML.
• SOAP was designed to be OS and Platform independent.
• It is built on top of HTTP which is installed in most systems.
• It is suggested by W3 consortium which is like a governing body for the web.
• SOAP is mainly used for Web Services and API.
P a g e | 26
Ans:
a. XML and HTML
XML HTML
XML stands for eXtensible Markup HTML stands for Hypertext Markup
Language Language
The main purpose is to focus on the Focusses on the appearance of the
transport of data and saving the data data. Enhances the appearance of
the text
XML is dynamic because it is used in HTML is static because its main
transport of data. function is to display the data.
It is case-sensitive. It is not case-sensitive
We can define tags as per our It has its own pre-defined tags, and it
requirement, but closing tags are is not necessary to have close tags.
mandatory.
XML is content-driven and not many HTML is presentation driven. How
formatting features are available. the text appears is of utmost
importance
Any error in the code shall not give Small errors in the code can be
the final outcome. ignored and the outcome can be
achieved.
It provides the language with java database connectivity standards. It is used to write
programs required to access databases. JDBC, along with the database driver, can
access databases and spreadsheets. The enterprise data stored in a relational
database(RDB) can be accessed with the help of JDBC APIs.
Components of JDBC:
There are generally four main components of JDBC through which it can interact with
a database.
P a g e | 28
1. JDBC API: It provides various methods and interfaces for easy communication with
the database. It provides two packages as follows, which contain the java SE and Java
EE platforms to exhibit WORA(write once run anywhere) capabilities.
java.sql.*;
It also provides a standard to connect a database to a client application.
Architecture of JDBC:
The basic idea behind XML Schemas is that they describe the legitimate format that
an XML document can take.
HTML is used to structure the web pages and Javascript is used to add behavior to
our web pages. When an HTML file is loaded into the browser, the javascript can not
understand the HTML document directly. So, a corresponding document is
created(DOM). DOM is basically the representation of the same HTML document but
in a different format with the use of objects. Javascript interprets DOM easily i.e
javascript can not understand the tags(<h1>H</h1>) in HTML document but can
understand object h1 in DOM. Now, Javascript can access each of the objects (h1, p,
etc) by using different functions.
DTD:
The XML Document Type Declaration, commonly known as DTD, is a way to describe
XML language precisely. DTDs check vocabulary and validity of the structure of XML
documents against grammatical rules of appropriate XML language.
An XML DTD can be either specified inside the document, or it can be kept in a
separate document and then liked separately.
P a g e | 31
Its main purpose is to define the structure of an XML document. It contains a list of
legal elements and define the structure with the help of them.
Components of DHTML:
• HTML 4.0: HTML is a client-side markup language, which is a core component
of the DHTML. It defines the structure of a web page with various defined
basic elements or tags.
• CSS: CSS stands for Cascading Style Sheet, which allows the web users or
developers for controlling the style and layout of the HTML elements on the
web pages.
Features:
• Its simplest and main feature is that we can create the web page dynamically.
• Dynamic Style is a feature, that allows the users to alter the font, size, color,
and content of a web page.
• It provides the facility for using the events, methods, and properties. And, also
provides the feature of code reusability.
• It also provides the feature in browsers for data binding.
P a g e | 32
• Using DHTML, users can easily create dynamic fonts for their web sites or web
pages.
• With the help of DHTML, users can easily change the tags and their properties.
• The web page functionality is enhanced because the DHTML uses low-
bandwidth effect.
Uses:
• It is used for designing the animated and interactive web pages that are
developed in real-time.
• DHTML helps users by animating the text and images in their documents.
• It allows the authors for adding the effects on their pages.
• It also allows the page authors for including the drop-down menus or rollover
buttons.
• This term is also used to create various browser-based action games.
• It is also used to add the ticker on various websites, which needs to refresh
their content automatically.
Ajax uses XHTML for content, CSS for presentation, along with Document Object
Model and JavaScript for dynamic content display.
With AJAX, when you hit submit, JavaScript will make a request to the server,
interpret the results, and update the current screen. In the purest sense, the user
would never know that anything was even transmitted to the server.
AJAX is a web browser technology independent of web server software.
Working of AJAX: