You are on page 1of 34

E.G.S.

PILLAY ENGINEERING COLLEGE


Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

1702IT504 – WEB PROGRAMMING


Academic Year : 2019-20 Programme : IT
Question Bank
Year / Semester : III/V Course Coordinator: Manikandan.S

Course Objectives Course Outcomes


1. To understand the concept of client / server After completion of the course, Student will be able to
programming CO1: Design web pages using HTML and CSS
2. To apply web programming languages for CO2: Develop web pages using java script.
developing web applications CO3: Develop server side programming techniques to solve real time
3. To know the unique features of scripting application.
languages CO4: Apply database concept to create interactive web pages.
CO5: Apply JSP concepts to solve real time applications
CO6: Create interactive and individual website that includes all web
programming features

PART – A ( 2 Mark Questions With Key) – K1/K2


S.No Questions Mark BTL
CO1 : Design web pages using HTML and CSS
1 Differentiate Internet and Web. 2
Internet: Tool to access resource anywhere or any place with the help of service provider K2
Web: Whole world resources (text, image, audio, video, etc)
2 Create 3*3 table using linked style sheets DHTML K2
2
<table cellspacing= cellpadding= ><tr> …<td>…..</td>..</tr>
3 Define URI, URL and URN. K1
1. URI (Uniform Resource Identifier): It identifies an object on the Internet.
2. URL (Uniform Resource Locator): It is a specification for identifying an object such as a
file, newsgroup, CGI program or e-mail address by indicating the exact location on the 2
internet.
3. URN (Uniform Resource Name): It is a method for referencing an object without declaring
the full path to the object.
4 Differentiate HTML over DHTML 2 K2
HTML is a simple page description language, which enables document creation for the web.
DHTML refers to collection of technologies, which makes HTML documents more dynamic
and interactive.
5 Define XHMTL and Why we go for XHTML. 2 K2
XHTML: Extensible HTML – Included CSS into html pages or Dynamic HTML Pages
Use: Interactive web pages and reusability
6 Explain the syntax of <frame> tags in detail? 2 K2
Frame: Partitioning the web pages
<frameset rows="30%,*" border="10" framespacing="0">
<frame src=top.html name=top>
</frame>
7 Define CSS and give one programming example 2 K1
CSS: Case cadding Style Sheet – Provide style and interactive web pages including font,
background and multimedia objects
<style type="text/css">
body
{
background-image: url("img149.jpg");
background-repeat: repeat
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

}
h1 {background-color: pink}
h2 {background-color: transparent}
p {background-color: rgb(25,20,25)}
</style>
8 Write the style sheet for displaying text with a different background and bigger font size? 2 K1
<style type="text/css">
body
{
background-image: url("img149.jpg");
background-repeat: repeat
}
h1 {background-color: pink}
h2 {background-color: transparent}
p {background-color: rgb(25,20,25)}
</style>
9 Write a DHTML program for performing font operations. 2 K1
body
{
background-color:skycolor;
}
h1{
class="veryimportant";
font-size: 20pt;
color: red;
}
p
{
font-size: 16pt; word-spacing:1 em;
text-indent: 0.5in;
}
a:link{color:blue;}
a:visited{color:red;}
10 Define scriptlets 2 K1
Scriptlets enable you to create small, reusable web applications that can be used in any web
page. Scriptlets are created using HTML, scripting and Dynamic HTML. To include them in
an HTML document use the <OBJECT> tag.
11 List of key features of DHMTL in internet explorer? 2 K1
Dynamic loading web pages, interactive pages, embedding multimedia objects
12 List the global HTML attributes with their purpose? 2 K1
Attribute Description
style Specifies an inline CSS style for an element
tabindex Specifies the tabbing order of an element
title Specifies extra information about an element
translate Specifies whether the content of an element should be translated or not
CO2 : Develop web pages using java script.
1 Write a javascript to display the position of mouse click? K2
function printMousePos() {
var cursorX;
var cursorY;
document.onmousemove = function(e){
cursorX = e.pageX;
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

cursorY = e.pageY;
}
document.getElementById('test').innerHTML = "x: " + cursorX + ", y: " + cursorY;
}
2 Differentiate VBScript and JavaScript. 2
JavaScript allows client-side scripts to interact with the users, communicate asynchronously,
control the browsers and alter the web page content which is displayed can be achieved
through JavaScript.
VBScript is a general scripting language developed on visual basic and developed by
K2
Microsoft. It is also called as an active scripting language. It is a visual basic edition scripting
language as it is developed (modeled) based on visual basic to be a lightweight scripting
language with a fast interpreter. VBScript is supported only by browser Internet Explorer and
it is mostly used in Microsoft environments and visual basic language products. It will be
installed by default in every windows desktop version.
3 Write a javascript code to perform arithmetic operations. 2 K2
var var1 = 45;
var var2 = 78;
var var3 = 45.10;
var var4 = 178.12;
var newvar = var1 + var2;
var newvar1 = var3 + var4;
var newParagraph3 = document.createElement("p");
var newText3 = document.createTextNode("var1 + var2 = "+newvar+" and var3 + var4 =
"+newvar1);
newParagraph3.appendChild(newText3);
document.body.appendChild(newParagraph3);
4 Why we need scripting languages? 2 K2
Scripting languages – perform problem solving operation in web pages
5 What is the benefit of using JavaScript code in an HTML document? 2 K1
JavaScript allows client-side scripts to interact with the users, communicate asynchronously,
control the browsers and alter the web page content which is displayed can be achieved
through JavaScript.
6 List out the objects involved in JavaScript with its purpose. 2 K1
Value Type Comment
"Hello" string "Hello" is always "Hello"
3.14 number 3.14 is always 3.14
true boolean true is always true
false boolean false is always false
null null (object) null is always null
undefined undefined undefined is always undefined
7 Write a javascript to print a mark list for 10 students in a HTML table. 2 K2
<table>
<%for(int v=1;v<=l;v++){System.out.println("l value"+l);String
cnames=rsmt.getColumnName(v);%>
<td width="50%"><font face="Arial, Helvetica" color = 'red'
size='5'><b><i><%=cnames.toUpperCase()%></i></b></font></td>
<%}%>
</tr><%
while(datars.next()){%>
<tr><%for (int vc=1;vc<=l;vc++){%>
<td width="50%"><font face="Arial,
Helvetica"><%=datars.getString(vc)%></font></td><%
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

}
}%></table>
8 Write a JavaScript code to find out odd and even number generation. 2 K2
<html >
<head>
<title>Test</title>
</head>
<body>
<script type="text/javascript">
/* <! */
var i;
for (i = 0; i < 1000; i++)
if ((i % 2) == 0)
document.writeln(i);

/* ]]> */
</script>
</body>
</html>
9 Write a Java script to use break and continue syntax 2 K2
<html>
<body>
<script type = "text/javascript">
<!--
var x = 1;
document.write("Entering the loop<br /> ");

while (x < 20) {


if (x == 5) {
break; // breaks out of loop completely
}
x = x + 1;
document.write( x + "<br />");
continue;
}
document.write("Exiting the loop!<br /> ");
//-->
</script>

<p>Set the variable to different value and then try...</p>


</body>
</html>
10 Generate Fibonaci Series using Java Script 2 K2
<html>
<head><title>Fibonacci Series</title></head>
<body>
<script type="text/javascript">
<!--
var var1 = 0;
var var2 = 1;
var var3;
var num = prompt("Enter the limit to generate fibonacci no",0);
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

document.write(var1+"<br />");
document.write(var2+"<br />");
for(var i=3; i <= num;i++)
{
var3 = var1 + var2;
var1 = var2;
var2 = var3;
document.write(var3+"<br />");
}
// -->
</script>
</body>
</html>
11 Write the java script to apply functions 2 K2
var numbers = [5, 6, 2, 3, 7];

// using Math.min/Math.max apply


var max = Math.max.apply(null, numbers);
// This about equal to Math.max(numbers[0], ...)
// or Math.max(5, 6, ...)

var min = Math.min.apply(null, numbers);

// vs. simple loop based algorithm


max = -Infinity, min = +Infinity;

for (var i = 0; i < numbers.length; i++) {


if (numbers[i] > max) {
max = numbers[i];
}
if (numbers[i] < min) {
min = numbers[i];
}
}
12 What are web clients and Servers? Give example for each 2 K1
When a client requests a connection to a server, the server can either accept or reject the
connection. If the connection is accepted, the server establishes and maintains a connection
with the client over a specific protocol. For example, an email client may request an SMTP
connection to a mail server in order to send a message. The SMTP application on the mail
server will then request authentication from the client, such as the email address and
password. If these credentials match an account on the mail server, the server will send the
email to the intended recipient.
CO3 : Develop server side programming techniques to solve real time application.
1 Distinguish between client and sever side scripting. 2
Client-side Environment

The client-side environment used to run scripts is usually a browser. The processing takes
place on the end users computer. The source code is transferred from the web server to the K2
users computer over the internet and run directly in the browser.
The scripting language needs to be enabled on the client computer. Sometimes if a user is
conscious of security risks they may switch the scripting facility off. When this is the case a
message usually pops up to alert the user when script is attempting to run.
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

Server-side Environment
The server-side environment that runs a scripting language is a web server. A user's request is
fulfilled by running a script directly on the web server to generate dynamic HTML pages.
This HTML is then sent to the client browser. It is usually used to provide interactive web
sites that interface to databases or other data stores on the server.
This is different from client-side scripting where scripts are run by the viewing web browser,
usually in JavaScript. The primary advantage to server-side scripting is the ability to highly
customize the response based on the user's requirements, access rights, or queries into data
stores.
2 Define Servlet Cookies 2 K1
A cookie is a small piece of information that is persisted between the multiple client requests.
A cookie has a name, a single value, and optional attributes such as a comment, path and
domain qualifiers, a maximum age, and a version number. By default, each request is
considered as a new request. In cookies technique, we add cookie with response from the
servlet. So cookie is stored in the cache of the browser. After that if request is sent by the
user, cookie is added with request by default. Thus, we recognize the user as the old user.
3 Write a note on Internet Information Server (IIS). 2 K1
Microsoft's Web server that runs on Windows NT platforms, In fact, IIS comes bundled with
Windows NT 4.0. Because IIS is tightly integrated with the operating system, it is relatively
easy to administer. However, currently IIS is available only for the Windows NT platform,
whereas Netscape' s Web servers run on all major platforms, including Windows NT
platform, OS/2 and UNIX.
4 List the advantages of CGI scripting 2 K1
1. CGI programs are relatively safe to run.
2. A CGI program can crash without damaging the server, since it only has limited access to
the server.
3. Reduces the burden of server
a. Sends prepared messages / mails e customer reply
b. Capability to process forms and prepares output based on form input.
c. Hit counts / Page counters.
5 What is meant by Stateless Connection? 2 K1
When a web server receives a HTTP request from a web browser it evaluates the request and
returns the requested document, if it exists, and then breaks the HTTP connection. This
document is preceded by the response header, which has details about how to display the
document that will be sent by the server. Each time a request is made to the server, it is as if
there was no prior connection and each request can yield only a single document. This is
known as Stateless Connection.
6 What are cookies and how it will be useful in website 2 K2
Cookies are a message given to a Web browser by a Web server. The browser stores the
message in a text file. A cookie is a baked or cooked food that is typically small, flat and
sweet. It usually contains flour, sugar and some type of oil or fat
7 Draw the architecture of servlet 2 K1

8 What is meant by event handling? 2 K1


E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

In programming, an event is an action that occurs as a result of the user or another source,
such as a mouse being clicked, or a key being pressed. An event handler is a routine that is
used to deal with the event, allowing a programmer to write code that will be executed when
the event occurs.
9 List out various event handlers 2 K1
Event handler Applies to: Triggered when:
onAbort Image The loading of the image is cancelled.
onBlur Button, Checkbox, FileUpload, Layer, Password, Radio, Reset, Select,
Submit, Text, TextArea, Window The object in question loses focus (e.g. by
clicking outside it or pressing the TAB key).
onChange FileUpload, Select, Text, TextArea The data in the form element is
changed by the user.
onClick Button, Document, Checkbox, Link, Radio, Reset, Submit The object is
clicked on.
10 Write a note on Environment variables 2 K1
In CGI, the server prepares the environment variables before it launches the CGI script. These
represent the current state of the server that is asking for the information. The environment
variables are not set from the command line but are created on the fly, and lasts only until that
particular script is finished. Each script gets its own unique set of variables and multiple
scripts can be executed at once, each in its own environment
11 What are STDIN and STDOUT? 2 K1
These are mnemonics for standard input and standard output, two predefined stream / file
handles. Each process already inherits these two handles already open. From the script's point
of view, STDIN is what comes from the browser via the server when the post method is used,
and the STDOUT is where it writes its output back to the browser. The script picks up the
environment variables and reads STDIN as appropriate. It then does whatever it was designed
to do and writes its output to STDOUT.
12 Explain about Session tracking 2 K2
A session is basically a conversation between a browser and a server. All the above
technologies can save information for the current session for a particular user visiting a site.
The session is important, as H1TP is a stateless protocol. This means that the connection
between web server and a web browser is not automatically maintained, and that the state of a
web session is not saved.
CO4: Apply database concept to create interactive web pages.
1 What is Electronic Data Interchange(EDI)? K1
Electronic Data Interchange (EDI) is the electronic interchange of business information using a
standardized format; a process which allows one company to send information to another company
electronically rather than with paper. Business entities conducting business electronically are called
trading partners.
2 What operations Multicast Socket Perform? 2 K1
Class MulticastSocket
java.lang.Object
java.net.DatagramSocket
java.net.MulticastSocket
All Implemented Interfaces:
Closeable, AutoCloseable
public class MulticastSocket
extends DatagramSocket
The multicast datagram socket class is useful for sending and receiving IP multicast packets.
A MulticastSocket is a (UDP) DatagramSocket, with additional capabilities for joining
"groups" of other multicast hosts on the internet.
A multicast group is specified by a class D IP address and by a standard UDP port number.
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

3 Write a note on content positioning characteristic "Visibility". K1


Enables the document author to selectively display or conceal positioned content; Possible
values are show or hide.
4 Write short note on isAlive() and join()? 2 K2
isAlive() and join() methods are used to determine whether a thread has finished or not. First,
you can call isAlive() on the thread. This method is defined by Thread, and its general form
is:
final Boolean isAlive()
The isAlive() method returns true if the thread upon which it is called is still running. It
returns false otherwise. While isAlive() is occasionally useful, the method that you will more
commonly use to wait for a thread to finish is called join().
The general form is:
final void join() throws InterruptedException
This method waits until the thread on which it is called terminates.
5 What is JDBC and ODBC? 2 K1
ODBC JDBC
ODBC Stands for Open Database Connectivity. Introduced by Microsoft in 1992. Introduced
by SUN Micro Systems in 1997. We can choose ODBC only windows platform. We can Use
JDBC in any platform. Java application it is highly recommended to use JDBC because there
we no performance & platform dependent problem.
Mostly ODBC Driver developed in native languages like C,C++.
We can use ODBC for any language like C,C++,Java etc
JDBC Stands for java database connectivity.
We can use JDBC only for Java languages.
6 What is the use of Driver Manager? 2 K1
The DriverManager class acts as an interface between user and drivers. It keeps track of the
drivers that are available and handles establishing a connection between a database and the
appropriate driver. The DriverManager class maintains a list of Driver classes that have
registered themselves by calling the method DriverManager.registerDriver().
7 Write the syntax for Connection String 2 K1
Server=myServerAddress;Database=myDataBase;User Id=myUsername;
Password=myPassword;
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
8 Draw the architecture of ODBC? 2 K1

9 Write the java code to connect database using connection string and resultset 2 K2
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection(
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

"jdbc:oracle:thin:@localhost:1521:xe","system","password");
ResultSet rs=stmt.executeQuery("select * from emp");
while(rs.next()){
System.out.println(rs.getInt(1)+" "+rs.getString(2));
}
10 List out various java classes in JDBC 2 K1
JDBC stands for Java Database Connectivity. JDBC is a Java API to connect and execute the
query with the database. It is a part of JavaSE (Java Standard Edition). JDBC API uses JDBC
drivers to connect with the database. There are four types of JDBC drivers:
JDBC-ODBC Bridge Driver,
Native Driver,
Network Protocol Driver, and
Thin Driver
11 Draw the structure of JDBC 2 K1

12 What do you meant by Class.forName? 2 K1


A call to Class.forName("X") causes the class named X to be dynamically loaded (at
runtime). A call to forName("X") causes the class named X to be initialized (i.e., JVM
executes all its static block after class loading).
CO5 : Apply JSP concepts to solve real time applications
1 Write a JSP program to get hours minutes and seconds from given date. 2 K2
<%@ page language="java"%>
<html>
<head>
<title>Even number program in JSP</title>
</head>

<body>
<%
for(int i=0;i<=10;i++)
{
if((i%2)==0)
{
out.print("Even number :"+i);
out.print("<br>");
}
}
%>
</body>
</html>
2 What is use of XML Namespace and give syntax 2 K1
XML Namespace is a mechanism to avoid name conflicts by differentiating elements or
attributes within an XML document that may have identical names, but different
definitions. We will be covering the basics ofnamespace, including declaration methods,
scope, attribute namespace, and default namespace.
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

3 What is use of XML Parser? 2 K1


XML Parser. A parser is a piece of program that takes a physical representation of some
data and converts it into an in-memory form for the program as a whole to use. Parsers are
used everywhere in software. An XML Parser is a parser that is designed to read XML and
create a way for programs to use XML.
4 Name the two types of directives available for use in a JSP document? 2 K1
<%@ page ... %> Defines page-dependent attributes, such as scripting language, error page,
and buffering requirements.
<%@ include ... %> Includes a file during the translation phase.
<%@ taglib ... %> Declares a tag library, containing custom actions, used in the page
5 Compare valid and well formed XML. 2 K2
Tags must nest properly. Every beginning and ending tag pair must fully contain any tag pair that
begins inside it. In other words, no start-tag, end-tag, empty-element tag, element, comment,
processing instruction, character reference, or entity reference can begin in one entity and end in
another.
The difference between well-formed and valid XML is simple: Valid XML has a DTD
associated with it and has been verified against all the rules contained in the DTD in addition
to being well-formed. Merely well-formed XML, on the other hand, is not necessarily valid,
although it may be.
6 Write a JSP code to retrieve data from database 2 K1
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
%>
<h2 align="center"><font><strong>Retrieve data from database in jsp</strong></font></h2>
<table align="center" cellpadding="5" cellspacing="5" border="1">
<tr>
7 Define voice XML? 2 K1
VoiceXML (VXML) is a digital document standard for specifying interactive media and
voice dialogs between humans and computers. It is used for developing audio and voice
response applications, such as banking systems and automated customer service portals.
8 Difference between HTML and XML? 2 K2
The prior difference is that in XML there are provisions for defining new elements while
HTML doesn't provide a specification to define new element and it uses predefined tags.
XML can be used to build markup languages while HTML itself is a markup language.
9 JSP program using addition of two Numbers. 2 K1
<%@ page language="java"%>
<html>
<head>
<title>Subtraction numbers program in JSP</title>
</head>

<body>
<%
int a=5;
int b=2;

int result=a-b;
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

out.print("Subtraction of a and b :"+result);


%>
</body>
</html>
10 Write the syntax for following, 2 K1
i. Embed CSS to XML
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="cssemployee.css"?>
<!DOCTYPE employee SYSTEM "employee.dtd">
<employee>
<firstname>vimal</firstname>
<lastname>jaiswal</lastname>
<email>vimal@javatpoint.com</email>
</employee>
ii. DTD to XML
The purpose of a DTD is to define the legal building blocks of an XML document. It defines
the document structure with a list of legal elements. A DTD can be declared inline in your
XML document, or as an external reference.
11 Draw the Structure of XML. 2 K1
XML Tree Structure. An XML document has a self descriptive structure. A
treestructure contains root element (as parent), child element and so on. It is very easy to
traverse all succeeding branches and sub-branches and leaf nodes starting from the root.
12 Differentiate JSP and ASP 2 K2
ASP stands for Active Server Pages, which is used in web development to implement
dynamic web pages. ASP is also a server side scripting language, which was created by
Microsoft. ASP is not free. ASP is not platform independent. ASP have not memory leak
protection
JSP stands for Java Server Pages, which helps developers to create dynamically web pages
based on HTML, XML, or other types. JSP is a server side scripting language, which was
created by Sun Micro systems. JSP is free of cost. JSP is platform independent.
JSP have memory leak protection.
CO6 : Create interactive and individual website that includes all web programming features
1 What are the pros and cons of web services. 2 K2
Pro: Web Services are standards-based.
Pro: Web Services’ loose coupling leads to increased modularity and flexibility in complex,
distributed IT environments.
Pro: Since Web Services are dynamically described, they will lead to systems that can be
upgraded automatically.
Pro: Web Services reduces integration costs.
Pro: Web Services simplify Business to Business Integration (B2Bi).
Pro: Web Services enable new business models.
Pro: Web Services leverage existing technology and skill sets.
Pro: Web Services enable less technical business people to ―assemble‖ software solutions
without the need for coding.
Pro: The Business Climate is Favorable to Web Services.
Con: Web Services are immature.
Con: Some vendor solutions are single-vendor approaches which conflict with the open
standards-based vision of Web Services.
Con: It is unclear where the money will be made in offering Web Services.
Con: The name ―Web Services‖ is vague and misleading.
2 Define SOAP. 2 K1
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

SOAP is an XML-based protocol for accessing web services over HTTP. It has some
specification which could be used across all applications.
SOAP is known as the Simple Object Access Protocol, but in later times was just shortened to
SOAP v1.2. SOAP is a protocol or in other words is a definition of how web services talk to
each other or talk to client applications that invoke them.
3 What do you meant by WSDL? 2 K1
WSDL is an XML format for describing network services as a set of endpoints operating on
messages containing either document-oriented or procedure-oriented information. The
operations and messages are described abstractly, and then bound to a concrete network
protocol and message format to define an endpoint
4 Specifies Actors role in SOAP. 2 K1
SOAP actor or role definition is: Actor or Role is a global attribute can be used to indicate the
recipient of a header element. The value of the SOAP actor attribute is a URI.
5 What is RMI? 2 K1
The RMI (Remote Method Invocation) is an API that provides a mechanism to create
distributed application in java. The RMI allows an object to invoke methods on an object
running in another JVM.
The RMI provides remote communication between the applications using two objects stub
and skeleton.
6 What is XML protocol Working Group? 2 K1
The XML Protocol ("XMLP") is a standard being developed by the W3C XML Protocol
Working Group to the following guidelines, outlined in the group's charter: An envelope for
encapsulating XML data to be transferred in an interoperable manner that allows for
distributed extensibility.
7 Define SMIL modularization? 2 K1
SMIL functionality is partitioned into modules based on the following design requirements:
Ensure that a profile may be defined that is completely backward compatibility with SMIL
1.0.
Ensure that a module's semantics maintain compatibility with SMIL semantics (this includes
content and timing).
Specify modules that are isomorphic with other modules based on W3C recommendations.
Specify modules that can complement XHTML modules.
Adopt new W3C recommendations when appropriate and not in conflict with other
requirements.
Specify how the modules support the document object model.
8 What do you mean by XPath, XLink, XPointer? 2 K1
XPath is a language that views the XML document as a tree with nodes. Using XPath, you
can locate any node in the XML document tree. XPointer provides a way to address the
internal structure of an XML document.
9 Write a DTD code for given XML Document 2 K2
<manager>
<customer>
<customer name> …..</customer name>
</customer>
<manager name>……..</manager name>
<company name>………</company name>
</manager>
<!DOCTYPE address [
<!ELEMENT address (name,company,phone)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT company (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

]>
<address>
<name>Tanmay Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 123-4567</phone>
</address>
10 Draw mosquito preview for XForms. 2 K1
XForms is the new markup language for forms on the Web. This document is a quick
introduction to XForms for HTML Forms authors. It shows you how to convert existing
forms to their XForms equivalent. It assumes knowledge of HTML Forms, so is not a
beginner's tutorial. Although there is mention of additional facilities of XForms beyond those
possible in HTML Forms (marked with an asterisk on the headings), it is not a full tutorial on
all features of XForms.
11 What are the uses of XML? 2 K1
General applications: XML provides a standard method to access information, making it
easier for applications and devices of all kinds to use, store, transmit, and display data.
12 Draw the Structure of Web Service Architecture 2 K1

PART – B (12 Mark Questions with Key) - K2/K3


S.No Questions Mark BTL
CO1: Design web pages using HTML and CSS
1 Explain various forms and their attributes with example
FORMS
Forms are used to display the GUI components in a page. In HTML we can create only static
pages ie., We can only design the forms. We can’t process the values given in them. The tag
used for creating forms are:
<FORM>…………………</FORM> - 2 marks 12 K2
The attributes of <form> tag are METHOD and POST.
METHOD = value – 2 marks
This attribute is used to specify how the data are send to the destination. The value is GET or
POST. ACTION = URL – 2 marks
Sample Program - 6 marks
2 Use various frame options to create multiple link web pages K3
12
FRAMES
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

In HTML we can split the screen into several parts called frames and we can display various
pages in each frame. Frames can be created - 2 marks
<FRAMESET>
Attributes – 2 marks
cols = values
This is used to split the screen vertically. The value of this attribute is the ratio in
which the screen is to be divided. rows = values
This is same as col except that it divides the screen horizontally.
<FRAME>
This tag is used to describe the content of each frame.
Attributes
SRC = path – 2 marks
This is used to specify the path of the file to be displayed in the frame.
NAME = value – 1 Mark
This is used to naming the frame for further use.
<NO FRAME> - 1 Mark
Sample Program – 4 marks
3 Write the script to print list items using ordered and unordered list K2
Lists in HTML are used to list the items using bullets and numbers. There are here types of
lists. They are :Ordered List, Unordered List, Definition List – 2 marks
Ordered List
Ordered list is used to list the items using numbers or alphabets. Tag used to create
an ordered list is <OL>………………..</OL>
Un ordered List
Un ordered list is used to list items using symbols called bullets. Tag used to create
unordered list is <UL>…………………..</UL>
<LI> tag 12
In both ordered and un ordered list, <LI> tag should precedes each item in a list.

Attributes of <OL> & <UL> - 2 marks


Start = value
This is used to specify the starting number of the ordered list.
Type = value
This is used to specify the style of the numbers or bullets. This is used with both
<OL> and <UL> tags.
Program – 8 marks
4 Write the syntax for creating table and use various table tags to create 3*3 table K2
In HTML tables can be created using the following tags.
<TABLE>……………..</TABLE> - 3 marks
The table creation must starts and ends with this tag.
<TR>……………….</TR> This tag is used to create a row in the table.
<TH> & <TD> These are used to add data to a row. <TH> tag display the data in bold
letters(heading).
ATTRIBUTES USED WITH <TABLE> - 3 marks 12
Border = value This is used to specify border size of the table.
Background = Path This is used to set an image as table background.
Bgcolor = value This is used to give background color for the table.
Cellspacing = value This is used to specify the distance between the cells.
Cellpadding = value This is used to specify the distance between the text and
the border of the cell.
Program – 6 marks
5 How DHTML helps in handling multimedia data? Explain with an example 12 K2
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

Create the image.html with CSS for setting the images at the correct index position
<style type="text/css"> - 2 marks
#img1{position:absolute;left:"260px";top:"230px"}
#img2{position:absolute;left:"290px";top:"260px"}
#img3{position:absolute;left:"320px";top:"290px"}
</style>
The three images are loaded into the web page with the tag - 2 marks
<img id="img2" src="gold petals.jpg" width="250px" height="300px" onClick="image2()">
The images can also be inserted using the following tag
<object height=70% width=75% type='image/jpeg' data='waterfall.jpg'></object>
Program – 8 marks
CO2: Develop web pages using java script.
1 Describe JavaScript Variables and DataTypes 12
JavaScript Data Types – 6 marks
i. Primitive data types
ii. Syntax
iii. Example K2
JavaScript Variables – 6 marks
i. Variable declaration and assignment
ii. Syntax
iii. Example
2 Design a web page to detect the visitor’s browser name and version using javascript?
Aim and procedure – 3 marks
Structure of the code – 3 mark
12 K3
Script syntax – 2 mark
Build-in syntax – 2 marks
Printing codes – 2 mark
3 Explain about javascript global function?
Definition of global function and Syntax – 3 marks
parseInt(x, [radix]) – 3 marks 12 K2
parseFloat(x) - 3 marks
Sample program - 3 marks
4 Create a script that prompts the user for a number and then counts from 1 to that number
displaying only the odd numbers.
<html>
<body>
<script type="text/javascript">
var count,f1,f2,f3;
var fib=new Array(10);
f1=1;
f2=-1;
for(count=0;count<10;count++)
12 K3
{
f3=f1+f2;
fib[count]=f3;
f2=f1;
f1=f3;
}
document.writeln("loop");
for(count in fib)
{
document.writeln("<b>"+fib[count]+"<b>");
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

}
</script>
</body>
</html>
5 Write the PHP program to display the details of Faculty 12 K3
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form method='POST'>
<h2>Please input your name:</h2>
<input type="text" name="name">
<input type="submit" value="Submit Name">
</form>
<?php
//Retrieve name from query string and store to a local variable
$name = $_POST['name'];
echo "<h3> Hello $name </h3>";
?>
</body>
</html>
CO3: Develop server side programming techniques to solve real time application.
1 Explain in detail about Microsoft IIS?
Abbreviation and Definition of IIS – 3 marks
Uses and Versions – 3 mark 12 K2
Protocols – 3 marks
Working principle – 3 marks
2 Write a script to display a drop down menu? K2
Aim and procedure – 3marks
Form creation – 2 mark 12
Accessing database – 2 mark
Events – 2 marks
Span definition – 3 marks
3 Describe Cookies in detail. K2
Definition and use of cookies - 3 marks
Syntax – 3 marks 12
Request and Response commands – 3 marks
Sample program – 3 marks
4 Explain Sessions in detail? K2
Steps and Syntax – 3 marks
Accessing the session object associated with the current request.
Looking up information associated with a session. 12
Storing information in a session – 3 marks
Discarding session data – 3 marks
Accessing the Session Object Associated with the Current Request – 3 marks
CO4: Apply database concept to create interactive web pages. K3
1 Write the java program for Connecting a java servlet program to a database for stock
maintenance
12
create database sonoo;
use sonoo;
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

create table emp(id int(10),name varchar(40),age int(3));


import java.sql.*;
class MysqlCon{
public static void main(String args[]){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/sonoo","root","root");
//here sonoo is database name, root is username and password
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from emp");
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
con.close();
}catch(Exception e){ System.out.println(e);}
}
}
2 Write short notes on JDBC Driver Manager. K2
A JDBC driver is a software component enabling a Java application to interact with a
database.[1] JDBC drivers are analogous to ODBC drivers, ADO.NET data providers, and
OLE DB providers.
To connect with individual databases, JDBC (the Java Database Connectivity API) requires
drivers for each database. The JDBC driver gives out the connection to the database and
implements the protocol for transferring the query and result between client and database.
JDBC technology drivers fit into one of four categories.
JDBC-ODBC bridge
Native-API driver
Network-Protocol driver (Middleware driver)
Database-Protocol driver (Pure Java driver) or thin driver.

12

3 Draw the Life Cycle of a Java Servlet and explain each stage with example K2
The web container maintains the life cycle of a servlet instance. Let's see the life cycle of the
servlet: 12

1. Servlet class is loaded.


E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

2. Servlet instance is created.


3. init method is invoked.
4. service method is invoked.
5. destroy method is invoked. – 10 marks

2 marks
4 Explain the different Types of JDBC Connections in Servers? K2
Type 1: JDBC-ODBC bridge
Type 2: partial Java driver
Type 3: pure Java driver for database middleware
Type 4: pure Java driver for direct-to-database
Type 5: highly-functional drivers with superior performance

12

5 Illustrate about the methods used in reading servlet parameters and reading initialization K2
parameters.
<web-app>
<servlet>
......

<init-param>
<param-name>parametername</param-name>
12
<param-value>parametervalue</param-value>
</init-param>
......
</servlet>
</web-app>
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

public class DemoServletInit extends HttpServlet {


public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter PW = response.getWriter();
ServletConfig config=getServletConfig();
String name=config.getInitParameter("name");
pw.print("Name is: "+driver);
pw.close();
}
}
Here web.xml is updated as following
<servlet>
<servlet-name>D</servlet-name>
<servlet-class>DemoServletInit</servlet-class>
<init-param>
<param-name>name</param-name>
<param-value>DiyaShirley</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>D</servlet-name>
<url-pattern>/Demo</url-pattern>
</servlet-mapping>
CO5: Apply JSP concepts to solve real time applications
1 Give detailed notes on JSP scripting elements. K2
A JSP page contains tags. The tags are in the form of scripting tags, directive tags and
comments. Tags help programmers to develop Java codeless JSP program. Implicit objects
increase the functionality of JSP page. Scripting element also helps in generating dynamic
content and displaying dynamic content.
1. Scriptlet tag
2. Declaration tag
3. Expression tag
1. Scriptlet Tag
Java code placed in scriptlet goes to _jspService (-,-) of JSP equivalent Servlet. We generally
place business logic or request processing logic in scriptlets. Then what happens for methods,
variables, and for implicit objects.
For methods
We can call methods from scriptlet but we cannot define methods in side scriptlet. Because 12
our defined method is going to be placed into _jspService (-,-) as a nested method but Java
does not support nested methods.
For variables
Scriptlet variables are locale variables in _jspService (-,-).
For implicit objects
All implicit objects are visible inside scriptlet
There are two syntaxes for JSP document/page.
•Standard syntax or traditional syntax
<% script codes %>
• XML based syntax
<jsp:scriptlet>
Script code
</jsp:script code>
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

2 Explain XML Namespaces in detail? K2


From Wikipedia, the free encyclopedia. XML namespaces are used for providing uniquely
named elements and attributes in an XML document. They are defined in a W3C
recommendation. An XML instance may contain element or attribute names from more than
one XML vocabulary.
An XML namespace is declared using the reserved XML attribute xmlns or xmlns:prefix, the
value of which must be a valid namespace name.
For example, the following declaration maps the "xhtml:" prefix to the XHTML namespace:
xmlns:xhtml="http://www.w3.org/1999/xhtml"
12
Any element or attribute whose name starts with the prefix "xhtml:" is considered to be in the
XHTML namespace, if it or an ancestor has the above namespace declaration.
It is also possible to declare a default namespace. For example:
xmlns="http://www.w3.org/1999/xhtml"
In this case, any element without a namespace prefix is considered to be in the XHTML
namespace, if it or an ancestor has the above default namespace declaration.
If there is no default namespace declaration in scope, the namespace name has no value.[6] In
that case, an element without an explicit namespace prefix is considered not to be in any
namespace.
3 Illustrate a WSDL example? K2

12

name is optional.
targetNamespace is the logical namespace for information about this service. WSDL
documents can import other WSDL documents, and setting targetNamespace to a unique
value ensures that the namespaces do not clash.
xmlns is the default namespace of the WSDL document, and it is set to
http://schemas.xmlsoap.org/wsdl/.
All the WSDL elements, such as <definitions>, <types> and <message> reside in this
namespace.
xmlns:xsd and xmlns:soap are standard namespace definitions that are used for specifying
SOAP-specific information as well as data types.
xmlns:tns stands for this namespace.
xmlns:ns1 is set to the value of the schema targetNamespace, in the <types> section.
4 Describe three main capabilities for including files and applets into a JSP document. K2
i) jsp:include action 12
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

This includes generated page, not JSP code. It cannot access environment of main
page in included code.
ii) include directive
Include directive includes dynamic page, i.e., JSP code. It is powerful, but poses
maintenance challenges.
iii) jsp:plugin action

This inserts applets that use the Java plug-in. It increases client side role in dialog.
Now, we will discuss in details about this capability of JSP.
• Including Files at Page Translation Time
You can include a file with JSP at the page translation time. In this case file will be
included in the main JSP document at the time the document is translated into a
servlet (which is typically the first time it is accessed).
To include file in this way, the syntax is:
<%@ include file= ―Relative URL‖ %>
There are two consequences of the fact that the included file is inserted at page
translation time, not at request time as with jsp: include.
First, you include the actual file itself, unlike with jsp:include , where the server runs
the page and inserts its output. This approach means that the included file can contain
JSP constructs (such as field or method declarations) that affect the main page as a.
whole.
Second, if the included file changes, all the JSP files that use it need to be updated.
• Including Files at Request Time
As you studied, the include directive provides the facility to include documents that
contain JSP code into different pages. But this directive requires you to update the
modification date of the page whenever the included file changes, which is a
significant inconvenience.
5 Explain how SOAP and web services have opened up new options for E- Commerce K2

12

CO6: Create interactive and individual website that includes all web programming features
1 Create XML Document For The Students Details Using Xml With XSL K3
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='cgpa.xsl'?>
<class> 12
<student>
<name> ABC </name>
<id> 001 </id>
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

<branch> IT </branch>
<cgpa> 9 </cgpa>
</student>
<student>
<name> PQR </name>
<id> 004 </id>
<branch> Computer </branch>
<cgpa> 7 </cgpa>
</student>
<student>
<name> XYZ </name>
<id> 006 </id>
<branch> IT </branch>
<cgpa> 10 </cgpa>
</student>
</class>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="https://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Student list in descending order of their CGPA.</h2>
<table border="1">
<tr bgcolor="lightblue">
<th>ID</th>
<th>Name</th>
<th>Branch</th>
<th>CGPA</th>
</tr>
<xsl:for-each select="class/student">
<xsl:sort select="cgpa" order="descending" data-type="number"/>
<tr>
<td><xsl:value-of select="id"/></td>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="branch"/></td>
<td><xsl:value-of select="cgpa"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
2 Explain structure of UDDI with necessary example. K2
UDDI is an XML-based standard for describing, publishing, and finding web services.
UDDI stands for Universal Description, Discovery, and Integration.
UDDI is a specification for a distributed registry of web services.
UDDI is a platform-independent, open framework.
12
UDDI can communicate via SOAP, CORBA, Java RMI Protocol.
UDDI uses Web Service Definition Language(WSDL) to describe interfaces to web services.
UDDI is seen with SOAP and WSDL as one of the three foundation standards of web
services.
UDDI is an open industry initiative, enabling businesses to discover each other and define
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

how they interact over the Internet.


A business or a company can register three types of information into a UDDI registry. This
information is contained in three elements of UDDI.
These three elements are −
White Pages,
Yellow Pages, and
Green Pages.

3 Differentiate DOM and SAX K2


1) DOM parser loads whole XML document in memory while SAX only loads a small part of
the XML file in memory.

2) DOM parser is faster than SAX because it access whole XML document in memory.

3) SAX parser in Java is better suitable for large XML file than DOM Parser because it
12
doesn't require much memory.

4) DOM parser works on Document Object Model while SAX is an event based XML parser.
That’s all on the difference between SAX and DOM parsers in Java, now it’s up to you on
which XML parser you going to choose. I recommend using DOM parser over SAX parser if
XML file is small enough and go with SAX parser if you don’t know the size of XML files to
be processed or they are large
4 Elaborate on the SOAP Intermediaries, Actors, Design Patterns and Faults. K2
he Need for Intermediaries
SOAP intermediaries are applications that can process parts of a SOAP message as it travels
from its origination point to its final destination point. The route taken by a SOAP message,
including all intermediaries it passes through, is called the SOAP message path.
Securing message exchanges, particularly through untrustworthy domains—You could secure
SOAP messages by passing them through an intermediary that first encrypts them and then
digitally signs them. On the receiving side an intermediary would perform the inverse
operations: checking the digital signature and, if it's valid, decrypting the message.
12
Notarization/nonrepudiation—when the sender or receiver (or both) desires a third party to
make a record of an interaction, a notarizing intermediary is a likely solution. Instead of
sending the message directly to the receiver, the sender sends to the intermediary, who makes
a persistent copy of the request and then sends it to the service provider. The response
typically comes back via the intermediary as well, and then both parties are usually given a
token they can use to reference the transaction record in the future.
Providing message tracing facilities—Tracing allows the message recipient to find out the
path the message followed, complete with detailed timings of arrivals and departures to and
from intermediaries. This information is indispensable for tasks such as measuring quality of
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

service (QoS), auditing systems, and identifying scalability bottlenecks.


5 Write short notes on ebXML Technologies and Overview of J2EE K2
Client tier—The client tier interacts with the user and displays information from the system to
the user. The J2EE platform supports different types of clients, including HTML clients, Java
applets, and Java applications.
Web tier—The Web tier generates presentation logic and accepts user responses from the
presentation clients, which are typically HTML clients, Java applets, and other Web clients.
Based on the received client request, The presentation tier generates the appropriate response
to a client request that it receives. In the J2EE platform, servlets and JSPs in a Web container
implement this tier.
12
Business tier—This tier handles the core business logic of the application. The business tier
provides the necessary interfaces to the underlying business service components. The
business components are typically implemented as EJB components with support from an
EJB container that facilitates the component life cycle and manages persistence, transactions,
and resource allocation.
EIS tier—This tier is responsible for the enterprise information systems, including database
systems, transaction processing systems, legacy systems, and enterprise resource planning
systems. The EIS tier is the point where J2EE applications integrate with non-J2EE or legacy
systems.

PART – C (20 Mark Questions with Key) - K3/K4


S.No Questions Mark BTL
CO1: Design web pages using HTML and CSS
1 Create the website for Faculty Development Program using forms and actions
1. Create the main.html with three frames using the tag as follows – 3 marks
<frameset rows="30%,*" border="10" framespacing="0">
<frame src=top.html name=top>
</frame>
2. <style type="text/css"> - 3 marks
body
{
background-image: url("img149.jpg");
background-repeat: repeat
}
h1 {background-color: pink}
h2 {background-color: transparent} 20 K3
p {background-color: rgb(25,20,25)}
</style>
3. The home.html is having the files of home.html, course.html, syllabus.html,
schedule.html, fees.html, regulations.html and contacts.html each gives the details about the
appropriate FDP regarding details. – 6 marks
4. The syllabus link of the details.html has created as rich text format using the tag
<a href = "syllabus.rtf" target = right>Syllabus</a>
5. In home.html the body background image has set using - 3 marks
<body background = "J0148309.jpg">
6. Hyperlinks can be given using – 5 marks
<a href = "tau.org.in">Click here to view the website of EGSPEC </a>
In fees.html the table has created using the tag
2 Create the website for Email ID creation using various event handlers 20 K3
<html>
<head>
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

Fill all items carefully</h2>


</font>
</head>
<body bgcolor="YELLOW">
<form action="F:\html\www.ssmb.html" method="post">
<FONT color="RED">
<h2>PERSONAL DETAILS:</h2></font>
NAME:<input type="text"><br><br>
Date Of Birth:<input type="text"><br><br>
CONTACT NO:<input type="TEXT"><br><br>
<p><h2>SEX:</h2></p>
<input type="radio" name=r1>MALE
<input type="radio" name=r2>FEMALE
<input type="radio" name=r3>THIRD PARTY<br><br>
<br>
<h2>MARTIAL STATUS:</h2>
<input type="radio" name=r1>Married
<input type="radio" name=r2>Un Married
<br>
<br>
NATIONALITY:<input type="text"><br><br>
CITY:<input type="text"><br><br>
<FONT color="red">
<h2>E-MailID DETAILS:</h2></font>
Enter your e-MailID:<input type="text"><br>
PassWord:<input type="password"><br>
Confirm your password:<input type="password"><br>
Alternate e-MailID:<input type="TEXT"><br><br>
<font color="RED"><h3>*There is no altenate e-mailID means enter the below
details:</h3></font>
<textarea>
ABOUT UR SELF
</textarea>
<br><br>
<font color="red">
<h2>ENSURE:</h2></font>
<textarea>
If you are fill all items and ensure this e-MailID use only on constructive purpose.And also I
couldnot misuse this e-MailID.</textarea>
<br>
<h3> I am accept above statement</h3>
<input type="radio" name=r1>NO
<input type="radio" name=r2>YES<br><br>
<br>
<input type="SUBMIT" VALUE="SUBMIT">
<input type="RESET" value="RESET">
</form>
</body>
</html>
CO2: Develop web pages using java script.
1 Write a java script program for performing functions with display window, open, read and
write operations. 20 K3
<html>
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

<head>
<title>MANI.S</title>
<script type="JavaScript">
function aa()
{ msg=open("","DisplayWindow","height=200,width=456,status=yes,toolbar=yes
directories=no,menubar=yes,location=yes");
msg.document.write("<html><title> A NEW WINDOW</title><body><img
src='F:\PICTURES\vijay1024_020708.gif'><p><form><input type='BUTTON'
value='CLOSE'"+"onClick='self.close()'>"+"</form></body></html></p>");
}
</script>
</head>
<body bgcolor="BLUE">
<p><form>
<input type="button" name="BUTTON" value="CLICK" onClick="aa()">
</form>
<p>
</body>
</html>
2 Explain handling HTTP GET and HTTP POST methods in java script with suitable example 20 K4
program
public void processRequest(HttpServletRequest request) {
// null value for submit - user hit enter instead of clicking on
// "add" or "remove"
if (submit == null)
addItem(item);
if (submit.equals("add"))
addItem(item);
else if (submit.equals("remove"))
removeItem(item);
// reset at the end of the request
reset();
}
<html>
<head>
<title>carts</title>
</head>
<body bgcolor="white">
<font size = 5 color="#CC0000">
<form type=POST action=carts.jsp>
<BR>
Please enter item to add or remove:
<br>
Add Item:
<SELECT NAME="item">
<OPTION>Beavis & Butt-head Video collection
<OPTION>X-files movie
</SELECT>
<br> <br>
<INPUT TYPE=submit name="submit" value="add">
<INPUT TYPE=submit name="submit" value="remove">
</form></FONT></body></html>
CO3: Develop server side programming techniques to solve real time application.
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

1 Develop an socket program to send a set of sales data(use your own sales fingures) one by
one to the server. Write the corresponding server side program to calculate the commission
for each sales man and return the result to the client
public class DummyCart {
Vector v = new Vector();
String submit = null;
String item = null;
private void addItem(String name) {
v.addElement(name);
}
private void removeItem(String name) {
v.removeElement(name);
}
public void setItem(String name) {
item = name;
}
public void setSubmit(String s) {
submit = s;
}
public String[] getItems() {
String[] s = new String[v.size()];
v.copyInto(s);
return s;
}
public void processRequest(HttpServletRequest request) {
// null value for submit - user hit enter instead of clicking on
// "add" or "remove" 20 K4
if (submit == null)
addItem(item);
if (submit.equals("add"))
addItem(item);
else if (submit.equals("remove"))
removeItem(item);
// reset at the end of the request
reset();
}
// reset
private void reset() {
submit = null;
item = null;
}
}
HTMLFilter.java
package util;
public final class HTMLFilter {
public static String filter(String message) {
if (message == null)
return (null);
char content[] = new char[message.length()];
message.getChars(0, message.length(), content, 0);
StringBuffer result = new StringBuffer(content.length + 50);
for (int i = 0; i < content.length; i++) {
switch (content[i]) {
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

case '<':
result.append("&lt;");
break;
case '>':
result.append("&gt;");
break;
case '&':
result.append("&amp;");
break;
case '"':
result.append("&quot;");
break;
default:
result.append(content[i]);
}
}
return (result.toString());
}}
2 How can you use the servlet session tracking API to keep track of visitors as they move K4
around at your site?
public class DisplayBookSax extends DefaultHandler
{
static private Writer writerOut;
StringBuffer stringBuffer;
public static void main(String f[])
{
DefaultHandler d=new DisplayBookSax();
SAXParserFactory saxParserFactory=SAXParserFactory.newInstance();
try
{
writerOut=new OutputStreamWriter(System.out,"UTF8");
SAXParser Sax_Parser=saxParserFactory.newSAXParser();
Sax_Parser.parse(new File(f[0]),d);
}
catch(Throwable thr)
20
{}
}
public void startDocument()throws SAXException
{
IOHandler("<?xml version='1.0' encoding='UTF-8'?>");
newLine();
}
public void endDocument()throws SAXException
{
try
{
newLine();
writerOut.flush();
}
catch(Throwable thr)
{}
}
CO4: Apply database concept to create interactive web pages.
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

1 Design JSP page to perform online library catalog access. 20 K3


CREATE TABLE "USER432"
( "NAME" VARCHAR2(4000),
"EMAIL" VARCHAR2(4000),
"PASS" VARCHAR2(4000)
)
<%@ include file="index.jsp" %>
<hr/>

<h3>Login Form</h3>
<%
String profile_msg=(String)request.getAttribute("profile_msg");
if(profile_msg!=null){
out.print(profile_msg);
}
String login_msg=(String)request.getAttribute("login_msg");
if(login_msg!=null){
out.print(login_msg);
}
%>
<br/>
<form action="loginprocess.jsp" method="post">
Email:<input type="text" name="email"/><br/><br/>
Password:<input type="password" name="password"/><br/><br/>
<input type="submit" value="login"/>"
</form>
<%@page import="bean.LoginDao"%>
<jsp:useBean id="obj" class="bean.LoginBean"/>

<jsp:setProperty property="*" name="obj"/>

<%
boolean status=LoginDao.validate(obj);
if(status){
out.println("You r successfully logged in");
session.setAttribute("session","TRUE");
}
else
{
out.print("Sorry, email or password error");
%>
<jsp:include page="index.jsp"></jsp:include>
<%
}
%>
2 Write the JSP code to create online order processing system 20 K3
<%@page import="bean.RegisterDao"%>
<jsp:useBean id="obj" class="bean.User"/>

<jsp:setProperty property="*" name="obj"/>

<%
int status=RegisterDao.register(obj);
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

if(status>0)
out.print("You are successfully registered");
%>
package bean;
public class User {
private String uname,upass,uemail;
public String getUname() {
return uname;
}
public void setUname(String uname) {
this.uname = uname;
}
public String getUpass() {
return upass;
}
public void setUpass(String upass) {
this.upass = upass;
}
public String getUemail() {
return uemail;
}
public void setUemail(String uemail) {
this.uemail = uemail;
}
}
public static int register(User u){
int status=0;
try{
Connection con=ConnectionProvider.getCon();
PreparedStatement ps=con.prepareStatement("insert into user432 values(?,?,?)");
ps.setString(1,u.getUname());
ps.setString(2,u.getUemail());
ps.setString(3,u.getUpass());
status=ps.executeUpdate();
}catch(Exception e){}
return status;
}
}
CO5: Apply JSP concepts to solve real time applications
1 How is XML useful in extending the Enterprise? Elaborate on the XML Technology Family. 20 K3
Elements, Tags, Attributes, Entities, PCDATA, and CDATA
Elements Elements are the main building blocks of both XML and HTML documents.
Tags Tags are used to markup elements.
Attributes Attributes provide extra information about elements.
PCDATA PCDATA means parsed character data
CDATA CDATA also means character data. CDATA is text that will NOT be parsed by a
parser
Entities Entities as variables used to define common text. Entity references are references to
entities.
<!ELEMENT [element_name] ([names of allowed elements])>
eg: <!ELEMENT sno (#PCDATA)>
External DTD: <!DOCTYPE note SYSTEM "student.dtd">
where student.dtd is the name of the DTD file. The tags developed in the DTD can
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

be used here for inserting the fields.

XML Document for the Students Details and DTD with DSS
Student.css
student
{
background.color:#FFFABC;
width=100%;
}
record
{
display:block;
color:BLACK;
font.size:20pt;
}
sno
{
display:block;
color:GREEN;
font.size:15pt;
}
<?xml version="1.0"?>
<!ELEMENT students (student+)>
<!ELEMENT student (record,sno,sname,dob,address,m1,m2,m3)>
<!ELEMENT record (#PCDATA)>
<!ELEMENT sno (#PCDATA)>
<!ELEMENT sname (#PCDATA)>
<!ELEMENT dob (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT m1 (#PCDATA)>
<!ELEMENT m2 (#PCDATA)>
<!ELEMENT m3 (#PCDATA)>

student.xml
?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="student.css"?>
<!DOCTYPE student SYSTEM "student.dtd">

<students>
<student>
<record>RECORD 1</record>
<sno>01110901001</sno>
<sname>ARUN BALAJI</sname>
<dob>04/01/1983</dob>
<address>Trichy</address>
<m1>80</m1>
<m2>85</m2>
<m3>90</m3>
</student>
<student>
<record>RECORD 2</record>
<sno>01110901002</sno>
<sname>ARUNABARATH</sname>
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

<dob>04/02/1982</dob>
<address>Chennai</address>
<m1>90</m1>
<m2>80</m2>
<m3>95</m3>
</student>
</students>
2 Create XML document for the students with TD/Schema 20 K4
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body bgcolor="orange">
<center><h1>Anna University of Technology</h1>
<h2>Tiruchirapalli</h2>
M.E (Modular Based Credit Banking System)
<h3>Student Details</h3>
<table border="5" bgcolor="lightgreen">
<tr>
<th>Register Number</th>
<th>Name</th>
<th>Department</th>
<th>Contact Address</th>
<th>Contact Number</th>
</tr>
<xsl:for-each select="STUDENT/CD">
<tr>
<td><xsl:value-of select="REGISTERNO"/></td>
<td><xsl:value-of select="NAME"/></td>
<td><center><xsl:value-of select="DEPARTMENT"/></center></td>
<td><xsl:value-of select="CONTACTADDRESS"/></td>
<td><xsl:value-of select="CONTACTNUMBER"/></td>
</tr>
</xsl:for-each>
</table></center>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
CO6: Create interactive and individual website that includes all web programming features
1 Create a XML Parser to retrieve student details using DOM 20 K4
The XML DOM defines a standard for accessing and manipulating XML. The w3c document
object model is a platform neutral interfcae that allows progrmas and scripts to dynamically
access abd update the content, structure and style of a document. The XML DOM views an
XML document as a tree-structure. The tree structure is called a node-tree. All nodes can be
accessed through the tree. Their contents can be modified or deleted, and new elements can
be created. The terms parent, child, and sibling are used to describe the relationships. Parent
nodes have children. Children on the same level are called siblings (brothers or sisters).
In a node tree, the top node is called the root
1 Every node, except the root, has exactly one parent node
2 A node can have any number of children
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

3 A leaf is a node with no children


4 Siblings are nodes with the same parent
Because the XML data is structured in a tree form, it can be traversed without knowing the
exact structure of the tree and without knowing the type of data contained within.
Procedure:
i. Create an XML Document, which contains the details of the students.
ii. Embed the <xsl:stylesheet xmlns:xsl= http://www.w3.org/TR/WD-xsl> and
<xsl:template match=/‖>tags top of the HTML document.
iii. Create a HTML page with suitable tags, which will display the headings of the
given student.
iv. A suitable logic is developed by using <xsl:for-each select=‖STUDENT/BIO‖> and
</xsl:for-each> to display the contents from the XML document to the HTML document.
2 Create Online book Retrival program using XSLT 20 K4
<?xml version="1.0" encoding="ISO8859-1" ?>
<?xml-stylesheet type="text/xsl" href="book1.xsl"?>
<BookInfo>
<Book>
<BookName>Intro to J2EE</BookName>
<BookPrice>$33</BookPrice>
<BookAuthor>MANI</BookAuthor>
</Book>
<Book>
<BookName>Intro to J2ME</BookName>
<BookPrice>$34</BookPrice>
<BookAuthor>MANI</BookAuthor>
</Book>
</BookInfo>

XSL PROGRAM (XSLT)


<?xml version="1.0" encoding="ISO8859-1" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="BookInfo">
<table border="2" width="100%">
<tr bgcolor="LIGHTBLUE">
<td>Book Name</td>
<td>Book Price</td>
<td>Author</td>
</tr>
<xsl:for-each select="Book1">
<tr bgcolor="LIGHTYELLOW">
<td><i><xsl:value-of select="Book1Name"/></i></td>
<td><xsl:value-of select="Book1Price"/></td>
<td><xsl:value-of select="Book1Author"/></td>
</tr>
E.G.S. PILLAY ENGINEERING COLLEGE
Rev.0
(An Autonomous Institution, Affiliated to Anna University, Chennai)
COE/2017/QB
Nagore Post, Nagapattinam – 611 002, Tamilnadu.

</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

You might also like