BCS-053 (MS Word Format) Available.

advertisement
Course Code
: BCS-053
Course Title: Web Programming
Assignment Number: BCA (V)/053/Assignment/2015
Maximum Marks : 100
Weightage
: 25%
October, 2015 (For July 2015 Session) April, 2016 (For January 2016 Session)
1. (Covers Block 1)
(a) What is meant by the term Web Service? Explain with the help of an example. List
various protocols that are used for creating a web service. Also explain the process of
creating a web service. (6 Marks)
ANs:
Web services are a way to communicate between different computers over the World Wide
Web. You already know that the Remote Procedure Call (RPC) allow distributed component
to communicate. Two RPC technologies, Distributed Component Object Model (DCOM) and
Common Object Request Broker Architecture (CORBA) are widely used. But, both the
technologies are too complex to provide interoperability among the computers.
DCOM is supported by Microsoft and uses the Object Remote Procedure Call
(ORPC) to interface components whereas CORBA is designed to be cross-platform
and it requires manual intervention. So, both the technologies are not fulfilling the goal of
universal interoperability.
HTTP
Protocol stands for Hyper Text Transfer Protocol. It is the protocol used to convey
information of World Wide Web (WWW). HTTP protocol is a stateless and connectionless
protocol. HTTP is called as a stateless protocol because each command request is executed
independently and it does not remember anything about previous execution. It is based on a
request/request paradigm. In this protocol the communication generally takes place over a
TCP/IP protocol.
SOAP
SOAP is an XML-based protocol for exchanging information between computers.





SOAP is a communication protocol.
SOAP is for communication between applications.
SOAP is a format for sending messages.
SOAP is designed to communicate via Internet.
SOAP is platform independent.
www.pixelesindia.com




SOAP is language independent.
SOAP is simple and extensible.
SOAP allows you to get around firewalls.
SOAP will be developed as a W3C standard.
WSDL
WSDL is an XML-based language for describing web services and how to access them.
 WSDL stands for Web Services Description Language.
 WSDL was developed jointly by Microsoft and IBM.
 WSDL is an XML based protocol for information exchange in decentralized and distributed
environments.
 WSDL is the standard format for describing a web service.
 WSDL definition describes how to access a web service and what operations it will perform.
 WSDL is a language for describing how to interface with XML-based services.
 WSDL is an integral part of UDDI, an XML-based worldwide business registry.
 WSDL is the language that UDDI uses.
 WSDL is pronounced as 'wiz-dull' and spelled out as 'W-S-D-L'.
UDDI








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 platform independent, open framework.
UDDI can communicate via SOAP, CORBA, and Java RMI Protocol.
UDDI uses 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
how they interact over the Internet.
Steps to create our simple Web Service:
 Create the Web Service business logic. First we need to write a Java class that implements
the Web Service business logic. In this case, our business logic will be a simple Java class that
simulates a stock quote service.
 Deploy the Java class to the SOAP server. Next we need to turn the Java class into a Web
Service. We'll show how to deploy the Java class to a SOAP server using the WASP
deployment tool.
 Generate client access classes. A client application uses a proxy object to access a Web
Service. At request time, the proxy accepts a Java method call from the application and
translates it into an XML message. At response time, the proxy receives the SOAP reply
message, translates it into Java objects, and returns the results to the client application.
 Client application development. The client application treats the proxy as a standard Java
object that facilitates the communication with a Web Service.
www.pixelesindia.com
(b) Create a simple form that may be used for appearing in the entrance test of a
University. The form should include details like name, mother/father name,
qualifications with degree name, year of passing the degree, percentage,
University/Board name; address (permanent and postal both), contact phone, email
Id, the programme in which admission is desired and related information. The form
should have relevant drop down lists such as List of Universities or Boards, list of
programmes etc. You must use CSS. Explain the advantages of using CSS.
(6 Marks)
Ans:
<html>
<head>
<title>Online Admission</title>
<link rel="stylesheet" type="text/css" href="css2.css">
</head>
<body>
<form name="f1">
<table>
<tr>
<td colspan="2"><h1><u>Admission of Entrance</u></h1></td>
</tr>
<tr>
<td>Name </td>
<td><input type="text"></td>
</tr>
<tr>
<td>Father's Name </td>
<td><input type="text"></td>
</tr>
<tr>
<td>Mother'S Name </td>
<td><input type="text"></td>
</tr>
www.pixelesindia.com
<tr>
<td>Qualification</td>
<td><input type="text" name="Min. Qualification" value=""></td>
</tr>
<tr>
<td>Pass out year </td>
<td> <input type="text"></td>
</tr>
<tr>
<td>Marks(%)</td>
<td><input type="text"></td>
</tr>
<tr>
<td>Programme</td>
<td>
<select name="tt">
<option>BCA</option>
<option>MCA</option>
<option>B.Tech</option>
<option>BSc</option>
</td>
</tr>
<tr>
<td>University/Board</td>
<td>
<select name="t">
<option>IGNOU</option>
<option>Jamia</option>
<option>JNU</option>
<option>DU</option>
www.pixelesindia.com
</td>
</tr>
<tr>
<td>Address </td>
<td> <input type="text"></td>
</tr>
<tr>
<td>Contact No. </td>
<td> <input type="text"></td>
</tr>
<tr>
<td>Email Id</td>
<td> <input type="text"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Submit"></td>
</tr>
</table>
</body>
</form>
</html>
Css file
table{
padding: 1% 200;
background:top repeat-x #FAFAFF ;
font-size:25pt;
color:#FF0066;
font-weight:bold;
font-align:left;
}
input[type="text"], input[type="email"], textarea, select,button[type="submit"] {
www.pixelesindia.com
color: #555;
height: 30px;
line-height:15px;
width: 100%;
padding: 0px 0px 0px 10px;
margin-top: 2px;
border: 1px solid #E5E5E5;
background: #FBFBFB;
outline: 0;
}
(c) Create a simple HTML based web page showing services offered in a Bank. The web page
should consist of three sections. All these three sections should be in separate divisions (using
<div> tags). The first section should show list of services offered by Bank, second section should
show the site plan and the third section should be a login area for the customers. Also create two
CSS files for this page that demonstrates how CSS can change the display format without affecting
the content. (6 Marks)
Ans:
Css1.css
.header{
padding: 2% 200;
background:top repeat-x #006F00;
border-bottom: solid 1px #001C32;
font-size:30pt;
color:#FF0066;
font-weight:bold;
}
.banner{
position:relative;
left:250px;
font-size:20pt;
color:#00FF66;
}
h1 {
color: maroon;
margin-left: 40px;
}
.div1
{
padding: 5 5 5 5;
width:30%;
position:relative;
left:0;
www.pixelesindia.com
background-color:#FF7791;
display: block;
float: left;
}
.div2
{
padding: 5 5 5 5;
width:30%;
position:relative;
left:3pt;
background-color:#11FF91;
display: block;
float: left;
}
.div3
{
padding: 5 5 5 5;
width:37.5%;
position:relative;
left:3pt;
background-color:#FF3391;
display: block;
float: right;
}
Css2.css
.header{
padding: 1% 200;
background:top repeat-x #FF0066;
border-bottom: solid 1px #001C32;
font-size:25pt;
color:#FFFFFF;
font-weight:bold;
}
.banner{
position:relative;
left:250px;
font-size:18pt;
color:#00FFFF;
We are teaching IGNOU’s BCA & MCA
Students
Why join us?
 Regular Classes
 BCA & MCA IGNOU Special Institute
 Free Trial Classes
 Subjective Knowledge
 Free PIXELES Guide Books (Prepared by
our teachers)
 Free Solved Assignments
 Experienced Faculties
 100% Results
 Home Test Series
 Class Test Series
 We teach you until you pass
 Final Year Synopsis & Project
 Proper Guidance
}
.div1
{
padding: 5 5 5 5;
width:30%;
position:relative;
left:0;
background-color:#FFFF91;
display: block;
www.pixelesindia.com
float: left;
}
.div2
{
padding: 5 5 5 5;
width:30%;
position:relative;
left:3pt;
background-color:#FFFF91;
display: block;
float: left;
}
.div3
{
padding: 5 5 5 5;
width:37.5%;
position:relative;
left:3pt;
background-color:#FFFF91;
display: block;
float: right;
}
Index.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="css1.css">
</head>
<body>
<div class="header">ABC BANK<span class="banner"> A Bank for All..............</span></div>
<br>
<div class="div1"><h1>Put here services offered by Bank<br>...............<br>...............<br></div>
<div class="div2">show the site plan.............. </div>
<div class="div3">
<form name="f1">
User ID :<input type="text"><br><br>
Password
:<input type="text"><br>
<input type="submit" value="Login">
<input type="submit" value="Cancel">
</form>
</div>
</body>
www.pixelesindia.com
</html>
(d) Explain the document structure of an XML document. A University programme contains
information like programme code, programme name, duration, credits etc. A programme consists
of a number of semesters. Every semester a number of courses are offered. Some of these courses
are compulsory and some optional. Create an XML documents containing information of five such
programmes. Also create the DTD for the XML document you have created.(8 Marks)
Ans:
An XML document has three parts:
A. The XML processing Instruction(s), also called the XML declaration;
B. The Document Type Declaration;
C. The document instance.
A. XML Declaration The XML processing instruction declares the document to be an
XML document for an application or parser this declaration is important. It may also
include: the version of XML, encoding type; whether the document is stand-alone;
The encoding attribute is used to inform the XML processor of the type of character
encoding in the document. For example: - UTF-8 and UTF-16 and ISO-10646-UCS2 are common encoding type.
<?xml version = “1.0” encoding = “UTF-8” ?>
B. Document Type Declaration (DTD)
A DTD is used to define the syntax and grammar of a document, that is, it defines the
meaning of the document elements. A Document Type Definition (DTD) sets all the
rules for the document regarding elements, attributes, and other components. This
DTD may be either an external DTD or Internal DTD.
 Internal DTD - An internal DTD document is contained completely within the
XML document.
 External DTD - An external DTD document is a seperate document, referenced
from within the XML document
C. Document Instance:-The instance contains the remaining parts of the XML
document, including the actual contents of the document, such as characters,
paragraphs, pages and graphics.
Elements are the most important part of an XML document. An element consists of
content enclosed in an opening tag and a closing tag. An element can contain
several different types of content: root element, child element and attributes.
DTD
<!DOCTYPE university [
<!ELEMENT university ( (pcode | pname | duration | credit)+)>
<!ELEMENT pname(semester, courses)>
<!ELEMENT pcode( #PCDATA )>
<!ELEMENT semester( #PCDATA )>
<!ELEMENT course( #PCDATA )>
<!ELEMENT duration ( #PCDATA )>
<!ELEMENT credit ( #PCDATA )>
<!ELEMENT salary( #PCDATA )>
]>
Documents
<university>
www.pixelesindia.com
<pcode>C001</pcode>
<pname>BCA<pname>
<semester>2</semester>
<course>c-language,CO,math</course>
</pname>
<duration>3 years</duration>
<credit>45</credit>
</university>
[Note: input four record similarly.]
(e) List at least 5 commands of JavaScript and explain them. Write a program using JavaScript that
changes the text colour and background colour of a division after every 5 seconds. (8 Marks)
Ans:
5 Commands in JavaScript
Terminates a switch or a loop
break
continue Jumps out of a loop and starts at the top
if ... else
Marks a block of statements to be executed, depending on a condition
switch
Marks a block of statements to be executed, depending on different cases
var
Declares a variable
<!DOCTYPE html>
<html>
<head>
<style>
#mydiv1 {
width: 200px;
height: 300px;
background-color:cyan;
color: #000000;
text-align:center;
}
</style>
</head>
<body onload="mypix()">
<script>
var col =new Array("red","green","blue");
var a=0
function mypix()
{
document.getElementById("mydiv1").style.backgroundColor =col[a];
a=a+1;
if(a>=3)
a=0;
setTimeout("mypix()", 5000);
}
www.pixelesindia.com
mypix()
</script>
<div id="mydiv1">
<h1>Classes for BCA</h1>
</div>
</body>
</html>
(f) Explain the input options used in WML with the help of an example each. Create a simple
WML program that should display an image and a table.(6 Marks)
Ans:
Input example:<p>PIXELES Classes<br/>
Student’s Name: <input name="name" size="20"/>
Enrol : <input name="enrol" size="20" />
Course: <input name="cc" size="20"/>
</p>
</card>
</wml>
Example Image and table
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card id="page1" title="Table and image in WML">
<p>
<table columns="3">
<tr>
<td>Cell A</td>
<td>Cell B</td>
<td>Cell C</td>
</tr>
<tr>
<td><img src="path" alt="myImage"/></td>
<td><img src="path" alt="myImage"/></td>>
<td><img src="path" alt="myImage"/></td>
</tr>
</table>
</p>
</card>
</wml>
2. (Covers Block 2)
(a) Explain the MVC Architecture with the help of a diagram. Also explain HTTP methods and their
use. (10 Marks)
Ans:
www.pixelesindia.com
This architecture is known as Model-View-Controller (MVC). This architecture can also be used for
the development of a web application. Figure 6 shows the component of web applications as per this
architecture.
Model
Sends updated
Information
View
Display Information
Requests action by Model
as per the request of the
User
User
Interacts with
Controller
Model: In the context of MVC a Model defines the data model and its access controls. The main role
of this component is to represent data and perform updates on it as per the defined rules. The main
responsibility of this component is to accept user requests and the data entered by the user and
perform the necessary data related function.
View: The function of the view will be to accept the data from the Model and convert it to form that
can be seen be a user in a user friendly way. Thus, view is responsible for displaying web pages for
the user.
Controller: A user may be allowed to interact with the web pages created by the Viewer component.
This interaction may be in the form of selection of options of Menu, pull down lists, check boxes etc.,
HTTP METHODS
 GET Method: The Get method is used to getting the data from the server.
 POST Method: The post method is used for sending data to the server.
 HEAD Method: When a user wants to know about the headers, like MIME types, charset,
Content- Length then we use Head method.
 TRACE Method: Trace the request message that is being received on the other side.
 DELETE Method: It is used for delete the resources, files at the requested URL
 OPTIONS Method: It lists the Http methods to which the thing at the requested URL can
respond.
 PUT Method: It put the enclosed information at the requested URL.
 CONNECT Method: It connects for the purpose of tunnelling.
www.pixelesindia.com
(b) Explain the uses of JSP elements with the help of examples. Also explain any five JSP implicit
objects.
(10 Marks)
ANs:
Elements of JSP:Directives
Directives are used as guiding the JSP container for translating and compilation of JSP page. It
appears at the top of the page.
Directives have the following syntax:
<%@ directive attribute = “value” %>
You can write XML equivalent of the above syntax as follows:
<jsp:directive. directivename attribute = “value” />
page Directive
The page Directive is used to specify the attributes of JSP page such as declaration of other resources
i.e. classes and packages,
<%@ page attribute = “value” %>
<%@ page import=”java.io.*, java.util.Date” buffer=”16k” autoFlush=”false” % >
include Directive
Include directive is an important JSP directive. This is used to insert text and code in the form of file
such as html, JSP into a current JSP document at the translation time.
<%@ include file = “relative URL” %>
JSP Implicit Object
JSP supports implicit objects which are listed below:Request Object
The request object is an instance of HttpServletRequest interface. This object is used to retrieves the
values that the client browser passed to the server during HTTP request such as cookies, headers or
parameters associated with the request.
For example:
<html><body><h2>Example of request Object</h2>
<% // Get the Programme Name from the request Query
String name=request.getQueryString();
out.println("Hello: "+name); %>
</body></html>
response Object
www.pixelesindia.com
As you know, response is a process to responding against it request. Using response object, reply is
sent back to the client browser.
<% response.sendRedirect(“http://www.ignou.ac.in”);%>
session Object
The session object is represented by the javax.servlet.http.HttpSession interface. This object is
behaves in same way as under the java servlet. For each user, servlet can create an HttpSession
object that is associated with a particular single user.
application Object
The application object is an instance of javax.servlet.ServletContext. This object has application
scope which means that it is available to all JSP pages until the JSP engine shut down. The
ServletContext is the environment where the servlet run.
page Object
It represents the javax.servlet.jsp.HttpJspPage interface. This object is reference to the current
instance of the JSP page. The page object is a synonym for this object and is not useful for
programming language.
(c) Differentiate between cookies and sessions with the help of an example. Create a simple HTML
login page and write suitable JSP program that checks the user ID and password entered by the
user in the HTML page, with a defined value (you need not use database for this problem). If the
username and ID is incorrect user is returned to HTML login page, else u is shown a message
"Welcome to JSP world".
(10 Marks)
Ans
Cookies – Cookies are small piece of information that is sent by web server in response header and
gets stored in the browser cookies. When client make further request, it adds the cookie to the
request header and we can utilize it to keep track of the session. We can maintain a session with
cookies but if the client disables the cookies, then it won’t work.
Session is a conversional state between client and server and it can consists of multiple request
and response between client and server. Since HTTP and Web Server both are stateless, the only
way to maintain a session is when some unique information about the session (session id) is passed
between server and client in every request and response.
Login.html
< html> <head>
<title>JSP Page</title>
</head>
<body>
<h1>Login Page</h1>
<center> <h2>Signup Details</h2>
<form action="LoginCheck.jsp" method="post"> <br/>
Username:<input type="text" name="username"> <br/>
Password:<input type="password" name="password"> <br/>
<input type="submit" value="Submit">
</form>
</center>
</body>
< /html>
Logincheck.jsp
www.pixelesindia.com
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<% String username=request.getParameter("username");
String password=request.getParameter("password");
if((username.equals("anurag") && password.equals("jain")))
{
session.setAttribute("username",username);
response.sendRedirect("Home.jsp"); }
else
response.sendRedirect("Error.jsp");
%>
</body>
< /html>
home.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<br/><br/><br/><br/><br/> <center> <h2>
<%
String a=session.getAttribute("username").toString();
out.println("Welcome to JSP World"+a);
%>
</center> </body>< /html>
(d) Explain different types of JDBC drivers. Create a database of username and passwords. Use the
same HTML login form as you created for part (c) above, but check the values from the database
using JSP. Explain all the steps that you have performed. Make suitable assumptions, if any.
Ans:
Type 1 JDBC Driver
A type 1 JDBC driver consists of a Java part that translates the JDBC interface calls to
ODBC calls. An ODBC bridge then calls the ODBC driver of the given database. Type 1
drivers are (were) mostly intended to be used in the beginning, when there were no type 4
drivers (all Java drivers). Here is an illustration of how a type 1 JDBC driver is organized:
www.pixelesindia.com
Type 1 JDBC driver.
Type 2 JDBC Driver
A type 2 JDBC driver is like a type 1 driver, except the ODBC part is replaced with a native
code part instead. The native code part is targeted at a specific database product. Here is an
illustration of a type 2 JDBC driver:
Type 2 JDBC driver.
Type 3 JDBC Driver
A type 3 JDBC driver is an all Java driver that sends the JDBC interface calls to an
intermediate server. The intermediate server then connects to the database on behalf of the
JDBC driver. Here is an illustration of a type 3 JDBC driver:
Type 3 JDBC driver.
Type 4 JDBC Driver
A type 4 JDBC driver is an all Java driver which connects directly to the database. It is
implemented for a specific database product. Today, most JDBC drivers are type 4 drivers.
Here is an illustration of how a type 4 JDBC driver is organized:
Type 4 JDBC driver.
<%@page import ="java.io.*"%>
<%@page import ="javax.servlet.*"%>
<%@page import ="javax.servlet.http.*"%>
<%@page import ="java.sql.*"%>
<%
String uid = request.getParameter("username");
String pass = request.getParameter("password");
try {
// Step 1. Load the JDBC driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Step 2. Create a Connection object
Connection con=DriverManager.getConnection("jdbc:odbc:pixdata");
www.pixelesindia.com
System.out.println("got connection");
// Step 3. Create a Statement object and call its executeUpdate
// method to insert a record
Statement s = con.createStatement();
"select * from Login where userID='"+loginid+"'";
// Step 4. Use the same Statement object to obtain a ResultSet object
sql = "SELECT userid, pass FROM Users where username=" ‘+uid+’;
ResultSet rs = s.executeQuery(sql);
while (rs.next())
{
u=rs.getString(1);
p= rs.getString(2);
}
if(uid.equals(u) && pass .equals(p))
{
out.println("Login successful");
}
else
{
out.println("incorrect username/password”);
rs.close();
s.close();
con.close();
}
catch (ClassNotFoundException e1)
{
// JDBC driver class not found, print error message to the console
System.out.println(e1.toString());
}
Disclaimer: Prepared by our students. Institution and
%>
publisher are neither responsible for the result of the any action
</body>
taken on the basis of this work or any omissions or errors.
</html>
www.pixelesindia.com

Generally, students opted project as Hotel Management, Hospital Management,
Library Management, Railway ticket booking, Airline ticket booking etc. These are
very common topics and not so good for your academic records as well as
performance evaluation.

We don't believe in above topics. We provide you a genuine and real project's topic.

We don't copy synopsis and project from anywhere.

We provide special academic project training to the students of BCA & MCA (IGNOU)
including Synopsis + project + Viva-voce.

We provide Synopsis with 100% Approval.
www.pixelesindia.com
Download