BCS-053 ASSIGNMENT SOLUTION (2018-19)

If you have any queries please leave a message here
Your Message
×


Question 1 : (Covers Block 1)

a) What is the meaning of "Web Services" and "Rich Internet Applications"? List at least two popular web services. How is a Rich Internet Application related to Web 2.0? Also find information on Web 3.0? How is it different than Web 2.0.

Answer : -

Web Services - A Web Service is can be defined by following ways :

The basic web services platform is XML + HTTP. All the standard web services work using the following components −

Rich Internet Application - A Rich Internet Application (RIA) is a Web application that is designed to deliver some key features and functions normally associated with desktop applications, which will help the user in accessing them. RIAs generally split the processing across the Internet/network divide by locating the user interface and related activity and capability on the client side. However, RIAs usually run inside a Web browser and normally do not require software installation on the client side to work. An RIA allows the client system to handle local activities, reformatting, calculations etc.

Web 2.0 - Web 2.0 is a technology shift that provides a user level interaction that was not available before in the web environment. However, Web 2.0 was introduced in 2004 as a second generation of the World Wide Web that is focused on how information is shared among people. The word 2.0 comes from the software industry, which describe the transition from static HTML pages to dynamic webpages organized based on serving the web application users.

There are three main parts :

Difference between Web 2.0 and Web 3.0 -

Web 2.0 - It is the “writable” phrase of the World Wide Web with interactive data. Unlike Web 1.0, Web 2.0 facilitates interaction between web users and sites, so it allows users to interact more freely with each other. Web 2.0 encourages participation, collaboration, and information sharing. Examples of Web 2.0 applications are Youtube, Wiki, Flickr, Facebook, and so on.

Web 3.0 - It is the “executable” phrase of Word Wide Web with dynamic applications, interactive services, and “machine-to-machine” interaction. Web 3.0 is a semantic web which refers to the future. In Web 3.0, computers can interpret information like humans and intelligently generate and distribute useful content tailored to the needs of users. One example of Web 3.0 is Tivo, a digital video recorder. Its recording program can search the web and read what it finds to you based on your preferences.




b) Create a re-registration form using HTML having the following input fields - Enrolment Number (it should contain only decimal digits), Name of the student (should contain only alphabets), programme code (it should be selected from a drop down list, default value BCA), Semester in which re-registering (should be maximum 10), valid email ID (it should be validated), Fee submission details (like Draft no, draft date and amount of fee submitted). The form should include a SUBMIT button. You must create a CSS file for this form. This CSS file should define font family, font size as 14 point, font colour as dark green, and background colour as light blue. Validate the form using JavaScript code as stated for various fields.

Answer : -

Registration.html

<html>
<head>
<title>Re-Registration Form</title>
<script type="text/javascript">
function AlphabetAndSpace(event)
{
var key = event.which || event.keyCode;
return ((key >= 65 && key <= 90) || (key >= 97 && key <= 122) || key == 32 || key == 8);
}
function Number(event)
{
var key = event.which || event.keyCode;
return ((key >= 48 && key <= 57) || key == 8);
}
function DecimalNumber(event)
{
var key = event.which || event.keyCode;
return ((key >= 48 && key <= 57) || key ==46 || key == 8);
}
</script>
<style>
body { background-color: #ADD8E6; }
h1 { font-family:Cambria; color: #008000; }
.textcss { font-size:14pt; font-family:Cambria; color: #008000; }
input[type="text"] { height: 40px; font-size:14pt; font-family:Cambria; color: #008000; }
input[type="email"] { height: 40px; font-size:14pt; font-family:Cambria; color: #008000; }
input[type="date"] { height: 40px; font-size:14pt; font-family:Cambria; color: #008000; }
input[type="submit"] { height: 40px; font-size:14pt; font-family:Cambria; font-weight: bold; width:350; color: #008000;}
select { height: 40px; width:350px; font-size:14pt; font-family:Cambria; color: #008000; width: 100px; }
select option { font-size:14pt; font-family:Cambria; color: #008000; }
</style>
</head>

<body>
<center><br /><h1>RE-REGISTRATION FORM</h1><br />
<form name="Registration" method="post" action="Re-Registration.jsp">
<table cellpadding="10" class="textcss">
<tr><td>Enrolment Number</td>
<td><input type="text" id="enrolment" name="enrolment" size="10" maxlength="9" onkeypress="return Number(event);"></td></tr>
<tr><td>Student Name</td>
<td><input type="text" id="sname" name="sname" size="25" maxlength="50" onkeypress="return AlphabetAndSpace(event);"></td></tr>
<tr><td>Programme Code</td>
<td><select id="pcode" name="pcode" size="1">
<option>BCA</option>
<option>MCA</option></td></tr>
<tr><td>Semester</td>
<td><select id="semester" name="semester" size="1">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option></td></tr>
<tr><td>E-mail ID<br /><br /><br /></td>
<td><input type="email" id="email" name="email" size="25" maxlength="100" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$"><br /><br /><br /></td></tr>
<tr><td>Draft Number</td>
<td><input type="text" id="draftno" name="draftno" size="14" maxlength="6" onkeypress="return Number(event);"></td></tr>
<tr><td>Draft Date</td>
<td><input type="date" id="draftdate" name="draftdate"></td></tr>
<tr><td>Draft Amount</td>
<td><input type="text" id="amount" name="amount" size="14" maxlength="10" pattern="[0-9]+\.[0-9]" onkeypress="return DecimalNumber(event);"></td></tr>
</table>
<br /><input type="submit" style='width:100' value="Submit"></center>
</body>
</html>




c) Using table and Lists create two web pages first showing the Semester wise courses of BCA having course code, course name and credits. The second page should display syllbus of one course using an unordered list. You should use <div> tags and create an internal CSS file which formats the web pages as follows :

Answer : -

Semester-Course.html

<html>
<head>
<title>Semester Course Details</title>
<style>
h1 { font-family:Cambria; }
table, th, td { border-collapse: collapse; border: 1px solid black; font-size:14pt; font-family:Cambria; }
th { text-shadow: 2px 2px #C0C0C0; }
tr:nth-child(even) { background-color: #90EE90; }
</style>
</head>
<body>
<center><br /><h1>BCA Programme Structure</h1><br />
<table cellpadding="10" bgcolor="#FFFFE0">
<tr><th>Semester</th><th>Course Code</th><th>Course Name</th><th>Credits</th></tr>
<tr style="border-top: 5px solid black;"><td>I</td><td>FEG-02</td><td>Foundation course in English -2</td><td>4</td></tr>
<tr><td></td><td>ECO-01</td><td>Business Organization</td><td>4</td></tr>
<tr><td></td><td>BCS-011</td><td>Computer Basics and PC Software</td><td>3</td></tr>
<tr><td></td><td>BCS-012</td><td>Mathematics</td><td>4</td></tr>
<tr><td></td><td>BCSL-013</td><td>Computer Basics and PC Software Lab</td><td>2</td></tr>
<tr style="border-top: 5px solid black;"><td>II</td><td>ECO-02</td><td>Accountancy-1</td><td>4</td></tr>
<tr><td></td><td>MCS-011</td><td>Problem Solving and Programming</td><td>3</td></tr>
<tr><td></td><td>MCS-012</td><td>Computer Organization and Assembly Language Programming</td><td>4</td></tr>
<tr><td></td><td>MCS-015</td><td>Communication Skills</td><td>2</td></tr>
<tr><td></td><td>MCS-013</td><td>Discrete Mathematics</td><td>2</td></tr>
<tr><td></td><td>BCSL-021</td><td>C Language Programming Lab</td><td>1</td></tr>
<tr><td></td><td>BCSL-022</td><td>Assembly Language Programming Lab</td><td>1</td></tr>
<tr style="border-top: 5px solid black;"><td>III</td><td>MCS-021</td><td>Data and File Structures</td><td>4</td></tr>
<tr><td></td><td>MCS-023</td><td>Introduction to Database Management Systems</td><td>3</td></tr>
<tr><td></td><td>MCS-014</td><td>Systems Analysis and Design</td><td>3</td></tr>
<tr><td></td><td>MCS-031</td><td>Programming in C++</td><td>3</td></tr>
<tr><td></td><td>BCSL-032</td><td>C++ Programming Lab</td><td>1</td></tr>
<tr><td></td><td>BCSL-033</td><td>Data and File Structures Lab</td><td>1</td></tr>
<tr><td></td><td>BCSL-034</td><td>DBMS Lab</td><td>1</td></tr>
<tr style="border-top: 5px solid black;"><td>IV</td><td>BCS-040</td><td>Statistical Techniques</td><td>4</td></tr>
<tr><td></td><td>MCS-024</td><td>Object Oriented Technologies and Java Programming</td><td>3</td></tr>
<tr><td></td><td>BCS-041</td><td>Fundamentals of Computer Networks</td><td>4</td></tr>
<tr><td></td><td>BCS-042</td><td>Introduction to Algorithm Design</td><td>2</td></tr>
<tr><td></td><td>MCSL-016</td><td>Internet Concepts and Web Design</td><td>2</td></tr>
<tr><td></td><td>BCSL-043</td><td>Java Programming Lab</td><td>1</td></tr>
<tr><td></td><td>BCSL-044</td><td>Statistical Techniques Lab</td><td>1</td></tr>
<tr><td></td><td>BCSL-045</td><td>Algorithm Design Lab</td><td>1</td></tr>
<tr style="border-top: 5px solid black;"><td>V</td><td>BCS-051</td><td>Introduction to Software Engineering</td><td>3</td></tr>
<tr><td></td><td>BCS-052</td><td>Network Programming and Administration</td><td>3</td></tr>
<tr><td></td><td>BCS-053</td><td>Web Programming</td><td>2</td></tr>
<tr><td></td><td>BCS-054</td><td>Computer Oriented Numerical Techniques</td><td>3</td></tr>
<tr><td></td><td>BCS-055</td><td>Business Communication</td><td>2</td></tr>
<tr><td></td><td>BCSL-056</td><td>Network Programming and Administration Lab</td><td>1</td></tr>
<tr><td></td><td>BCSL-057</td><td>Web Programming Lab</td><td>1</td></tr>
<tr><td></td><td>BCSL-058</td><td>Computer Oriented Numerical Techniques Lab</td><td>1</td></tr>
<tr style="border-top: 5px solid black;"><td>VI</td><td>BCS-062</td><td>E-Commerce</td><td>2</td></tr>
<tr><td></td><td>MCS-022</td><td>Operating System Concepts and Networking Management</td><td>4</td></tr>
<tr><td></td><td>BCSL-063</td><td>Operating System Concepts and Networking Management Lab</td><td>1</td></tr>
<tr><td></td><td>BCSP-064</td><td>Project</td><td>8</td></tr>
</table><br />
</body>
</html>

Syllabus.html

<html>
<head>
<title>Syllabus of BCS-053</title>
<style>
h1 { font-family:Cambria; color:#8B0000; }
h2 { font-family:Cambria; color:#00008B; }
.textcss { font-size:14pt; font-family:Cambria; }
.subheader { font-size:16pt; font-family:Cambria; font-weight: bold; color:#008000; }
</style>
</head>
<body>
<center><h1>BCS -053: Web Programming</h1></center><br />
<h2>BLOCK 1: Client Side</h2>
<p class="subheader">Unit 1 : Web 2.0 and XHTML</p>
<div class="textcss">What Is Web 2.0? Introduction to Web 2.0 terms: Search, Content Networks, Blogging, Social Networking, Social Media, Rich Internet Applications (RIAs), Web Services, Mashups, Widgets and Gadgets, Introduction to XHTML and WML, Syntactic Differences between HTML and XHTML, Standard XHTML Document Structure, An example of XHTML covering Basic Syntax, Images, Hypertext Links, Lists and Tables, Creation of an XHTML Form, Internal Linking and Meta Elements</div>
<p class="subheader">Unit 2 : Using Style Sheets</p>
<div class="textcss">CSS: In-line Styles, Embedded Style Sheets, Linking External Style Sheets, Style Specification Formats Selector Forms, Colour, Property Value Forms, Font Properties, List Properties, Alignment of Text, The Box Model, Background Image ,The &ltspan&gt and &ltdiv&gt Tags</div>
<p class="subheader">Unit 3 : Introduction to XML</p>
<div class="textcss">XML Basics, XML Document Structure, XML Namespaces, Document Type Definitions, XML Schemas, Displaying XML Documents</div>
<p class="subheader">Unit 4 : Programming with JavaScript DOM and Events</p>
<div class="textcss">The Document Object Model, Element Access in JavaScript, Traversing and Modifying a DOM Tree, DOM Collections and Styles, Events, Examples of Event Handling from Body, Button, Text Box and Password Elements, Dynamic Documents using JavaScript element moving, visibility, positioning etc., Example program (s),Introduction and example of AJAX</div>
<p class="subheader">Unit 5 : Introduction to WAP and WML</p>
<div class="textcss">WAP and WML Basics, WML formatting and links, WML input, WML tasks, WML timer, WML variables, Example</div>
<br /><h2>BLOCK 2: Server Side</h2>
<p class="subheader">Unit 1 : The Server Side Scripting</p>
<div class="textcss">Server side scripting and its need ,Two-Tier, Three-Tier, N-Tier and Enterprise Architecture, Various Languages/ Technologies for server scripting ,HTTP Methods (such as GET, POST, HEAD, and so on) , Purpose ,Technical characteristics, Method selection, Use of request and response primitives, Web container Tomcat</div>
<p class="subheader">Unit 2 : JSP Basic</p>
<div class="textcss">Basic JSP Life-cycle, JSP Directives and Elements, Scriptlets, Expressions, Action Elements, Standard Actions, Comments and Template Data, JSP variables, The out Object, Request, response, sessions and application objects</div>
<p class="subheader">Unit 3 : JSP Applications</p>
<div class="textcss">Exceptions and exception handling using JSP, Cookies and sessions, Managing Email using JSP</div>
<p class="subheader">Unit 4 : JSP Application Development</p>
<div class="textcss">Example applications using JSP, What is JDBC? Need for JDBC, Database Drivers, Connection using JDBC API, Application development and deployment</body>
</html>




d) A University maintains the list of its students using XML. Each student has a unique enrolment number which may be used as an attribute in XML document. The XML document also stores the student name, programme name, and result of zero or more subjects. In addition, optional email id and telephone numbers may also be stored. Create an XML documents containing information of five such student records. Also create the DTD for the XML document created by you.

Answer : -

StudentDocument.dtd

<!ELEMENT University (Student+)>
<!ELEMENT Student (EnrolmentNo, Name, ProgrammeCode, Email?, Phone?, Result?)>
<!ELEMENT EnrolmentNo (#PCDATA)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT ProgrammeCode (#PCDATA)>
<!ELEMENT Email (#PCDATA)>
<!ELEMENT Phone (#PCDATA)>
<!ELEMENT Result (Subject+)>
<!ELEMENT Subject (CourseCode, Marks)>
<!ELEMENT CourseCode (#PCDATA)>
<!ELEMENT Marks (Assignment, (Lab|Theory))>
<!ELEMENT Assignment (#PCDATA)>
<!ELEMENT Lab (#PCDATA)>
<!ELEMENT Theory (#PCDATA)>

Student.xml

<?xml version="1.0" ?>
<!DOCTYPE Student SYSTEM "StudentDocument.dtd">
<University>
<Student>
<EnrolmentNo>180082562</EnrolmentNo>
<Name>Rohit Sen</Name>
<ProgrammeCode>BCA</ProgrammeCode>
</Student>
<Student>
<EnrolmentNo>184082458</EnrolmentNo>
<Name>Amit Kumar Das</Name>
<ProgrammeCode>BCA</ProgrammeCode>
<Email>amitdas90@gmail.com</Email>
<Phone>9085524219</Phone>
</Student>
<Student>
<EnrolmentNo>164082008</EnrolmentNo>
<Name>Swarup Paul</Name>
<ProgrammeCode>BCA</ProgrammeCode>
<Result>
<subject>
<CourseCode>BCS-052</CourseCode>
<Marks>
<Assignment>80</Assignment>
<Theory>49</Theory>
</Marks>
</subject>
<subject>
<CourseCode>BCSL-057</CourseCode>
<Marks>
<Assignment>72</Assignment>
<Lab>56</Lab>
</Marks>
</subject>
</Result>
</Student>
<Student>
<EnrolmentNo>160014596</EnrolmentNo>
<Name>Ankitaa Das</Name>
<ProgrammeCode>BCA</ProgrammeCode>
<Phone>9748516231</Phone>
<Result>
<subject>
<CourseCode>BCS-052</CourseCode>
<Marks>
<Assignment>65</Assignment>
<Theory>52</Theory>
</Marks>
</subject>
</Result>
</Student>
<Student>
<EnrolmentNo>164592598</EnrolmentNo>
<Name>Somraj Dey</Name>
<ProgrammeCode>BCA</ProgrammeCode>
<Email>somraj1991@gmail.com</Email>
<Phone>8274645983</Phone>
<Result>
<subject>
<CourseCode>BCS-052</CourseCode>
<Marks>
<Assignment>75</Assignment>
<Theory>46</Theory>
</Marks>
</subject>
<subject>
<CourseCode>BCS-053</CourseCode>
<Marks>
<Assignment>62</Assignment>
<Theory>50</Theory>
</Marks>
</subject>
<subject>
<CourseCode>BCSL-057</CourseCode>
<Marks>
<Assignment>78</Assignment>
<Lab>58</Lab>
</Marks>
</subject>
</Result>
</Student>
</University>




e) Write a JavaScript code that changes the background of the page after every 10 seconds. Make suitable assumptions, if any.

Answer : -

BackgroundColorChange.html

<head>
<script type="text/javascript">
var i = 0;
function change()
{
var doc = document.getElementById("background");
var color = ["#FFB6C1", "#90EE90", "#ADD8E6", "#FFA07A", "#FFFFE0"];
doc.style.backgroundColor = color[i];
i = (i + 1) % color.length;
}
setInterval(change, 10000);
</script>
</head>
<body id="background">
<center><h1>Change Background Color Every 10 Seconds</h1></center>
</body>
</html>

BackgroundImageChange.html

<html>
<head>
<script type="text/javascript">
var images=['D:/image/img1.jpg', 'D:/image/img2.jpg', 'D:/image/img3.jpg', 'D:/image/img4.jpg'];
var i=0;
function change()
{
document.body.style.backgroundImage = 'url('+images[i]+')';
i= (i + 1) % images.length;
}
setInterval(change, 10000);
</script>
</head>
<body>
<center><h1>Change Background Image Every 10 Seconds</h1></center>
</body>
</html>




f) Explain the WAP model with the help of a diagram. Give examples of use of WML table and image tags.

Answer : - The following diagram illustrates the general architecture of the WAP protocol stack :

Application Layer (WAE)
Session Layer (WSP)
Transaction Layer (WTP)
Security Layer (WTLS)
Transport Layer (WDP)
Bearers (GSM, CDMA,…)

WAE – Wireless Application Environment
The Wireless Application Environment (WAE) defines the following functions :


WSP – Wireless Session Protocol
The Wireless Session Protocol (WSP) implements an interface for connection-oriented and connectionless session services. The connection-oriented session service operates using the protocol of the transaction layer. However, the connectionless session service uses a secure or non-secure datagram service.

WSP offers the following basic functions :


WTP – Wireless Transaction Protocol
The Wireless Transaction Protocol (WTP) is a transaction-oriented protocol, executed using a datagram service. WTP offers the following functions :


WTLS – Wireless Transaction Layer Security
The WTLS layer implements a security protocol based on the TLS (Transport Layer Security) industry standard. WTLS is intended for use with the WAP transport protocols and has the following features :


WDP – Wireless Datagram Protocol
The WDP layer operates on various bearers that depend on the used network type. WDP offers a consistent interface for the upper layers, so that communications occurs transparently using one of the available bearer services. Therefore, the transport layer is adapted to the specific functions of the underlying bearer.


Bearers
The bearers that are used by the WAP protocol stack form the lower interface of the datagram service and allow the WAP to be used for various network types with specific bearer functions. Thus, WDP is defined for a variety of bearers. For an IP bearer, the transport protocol (WDP) is implemented by User Datagram Protocol (UDP).






Question 2 : (Covers Block 2)

a) What is MVC architecture? Explain with the help of a diagram. What is meant by HTTP methods? Explain the difference between GET and POST method. Which of the two is a safe method and why? What is a web container? Why are they used?

Answer : - Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts -

Model

View

Controller


HTTP Methods

The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers.

HTTP works as a request-response protocol between a client and server.

A web browser may be the client, and an application on a computer that hosts a web site may be the server.

Example: A client (browser) submits an HTTP request to the server; then the server returns a response to the client. The response contains status information about the request and may also contain the requested content.


Difference between GET and POST

GETPOST
In case of Get request, only limited amount of data can be sent because data is sent in header.In case of post request, large amount of data can be sent because data is sent in body.
Get request is not secured because data is exposed in URL bar.Post request is secured because data is not exposed in URL bar.
Get request can be bookmarked.Post request cannot be bookmarked.
GET requests have length restrictionsPOST requests have no restrictions on data length
Only ASCII data can be sentAny type of data can be sent including binary data

Safe Methods

We know that all HTTP methods deal with resource. Some read the state of resource or some create/update the state of resource.

If an HTTP method does not change/modify the resource information on the server side or perform read only operation, is called a SAFE HTTP Method. The reason it is called as a safe method as it does not alter resource information and prevents actual resource state. GET and HEAD HTTP methods are safe methods. This methods perform read only operations.


Web Container

Web Container is an java application that controls servlet. Servlet do not have a main() method, So they require a container to load them. Container is a place where servlet gets deployed.

When a client sends a request to web server that contain a servlet, server sends that request to container rather than to servlet directly. Container then finds out the requested servlet and pass the Http Request and response to servlet and loads the servlet methods i.e. doGet( ) or doPost( ).




b)Which JSP element/elements will be required for performing each of the following tasks/activities. Explain these JSP elements with the help of an example each.

Answer : -

ii. Including the content statically or dynamically

Static Include Example
index.jsp

<html>
<body>
<%@ include file="printdate.jsp"%>
</body>
</html>

printdate.jsp

<% out.print("Today is : "+java.util.Calendar.getInstance().getTime()); %>


Dynamic Include Example
index.jsp

<html>
<body>
<jsp:include page="printdate.jsp" />
</body>
</html>

printdate.jsp

<% out.print("Today is : "+java.util.Calendar.getInstance().getTime()); %>


iii. Getting a parameter from a jsp form

index.html

<html>
<body>
<form action="welcome.jsp">
<input type="text" name="uname">
<input type="submit" value="Go">
</form>
</body>
</html>

welcome.jsp

<html>
<body>
<%
String name=request.getParameter("uname");
out.print("welcome "+name);
%>
</body>
</html>


iv. Performing a computation repeatedly

index.jsp

<html>
<body>
Current Time : <%= java.util.Calendar.getInstance().getTime() %>
</body>
</html>




c) An application requires that a user logs on to a web site and performs electronic transactions with proper error correction. Explain what kind of JSP coding will be required to perform this kind of application. Your answer must focus on error correction and session management.

Answer : -


d) Explain the process of a web application development and deployment with the help of an example of the following system:

Develop and deploy a Book issue and return system for a small library. You may assume that library issues Books only. A member can be issued only one Book. No fine is charged on late return. You must use a database with two to three tables - one for Books, second for members and third for issued books. Your application should display the list of books, list of members and list of issued books.

Make and state suitable assumptions.

Answer : -

Home.html

<html>
<head>
<title>Library Management System</title>
<style>
.textcss { font-size:14pt; font-family:Cambria; }
input[type="text"] { height: 40px; font-size:14pt; font-family:Cambria; }
input[type="button"] { height: 40px; font-size:14pt; font-family:Cambria; width:220; }
input[type="submit"] { height: 40px; font-size:14pt; font-family:Cambria; width:120; }
</style>
</head>
<body>
<center><br /><h1>Library Management System</h1>
<form name="IssueBooks" method="post" action="BookIssue.jsp">
<table cellpadding="10" class="textcss">
<tr><td>Book ID</td>
<td colspan="2"><input type="text" id="bookid" name="bookid" size="20" maxlength="10"></td></tr>
<tr><td>Member ID</td>
<td><input type="text" id="memberid" name="memberid" size="20" maxlength="10"></td>
<td><input type="submit" value="Issue Book"></td></tr>
</table>
</form>
<br /><br /><br />
<a href="Return.html"><input type="button" value="Return Book"></a>
<br /><br /><br />
<a href="BookList.jsp"><input type="button" value="List of Books"></a>
<a href="MemberList.jsp"><input type="button" value="List of Members"></a>
<a href="BookIssueList.jsp"><input type="button" value="List of Issued Books"></a>
</center>
</body>
</html>


Return.html

<html>
<head>
<title>Library Management System</title>
<style>
.textcss { font-size:14pt; font-family:Cambria; }
input[type="text"] { height: 40px; font-size:14pt; font-family:Cambria; }
input[type="submit"] { height: 40px; font-size:14pt; font-family:Cambria; width:120; }
</style>
</head>
<body>
<center><br /><h1>Library Management System</h1>
<form name="ReturnBooks" method="post" action="ReturnBook.jsp">
<table cellpadding="10" class="textcss">
<tr><td>Book ID</td>
<td colspan="2"><input type="text" id="bookid" name="bookid" size="20" maxlength="10"></td></tr>
<tr><td>Member ID</td>
<td><input type="text" id="memberid" name="memberid" size="20" maxlength="10"></td>
<td><input type="submit" value="Return Book"></td></tr>
</table>
</form></center>
</body>
</html>


BookIssue.jsp

<%@page import="java.sql.*"%>
<html>
<body>
<%
int bookid=Integer.parseInt(request.getParameter("bookid"));
int memberid=Integer.parseInt(request.getParameter("memberid"));
String url="jdbc:mysql://localhost:3306/Library";
String user="Admin";
String password="Admin1234";
String SQL="SELECT * FROM bookissue WHERE bookid="+bookid+" OR memberid="+memberid;
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(SQL);
if(rs.next())
{
out.println("<br /><center><h1><font color='red'>Book Issue Failed !</font></h1></center>");
}
else
{
SQL="INSERT INTO bookissue VALUES("+bookid+","+memberid+")";
stmt.executeUpdate(SQL);
out.println("<br /><center><h1>Book Issue Successfully Completed</h1></center>");
}
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</body>
</html>


ReturnBook.jsp

<%@page import="java.sql.*"%>
<html>
<body>
<%
int bookid=Integer.parseInt(request.getParameter("bookid"));
int memberid=Integer.parseInt(request.getParameter("memberid"));
String url="jdbc:mysql://localhost:3306/Library";
String user="Admin";
String password="Admin1234";
String SQL="SELECT * FROM bookissue WHERE bookid<>"+bookid+" OR memberid<>"+memberid;
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(SQL);
if(rs.next())
{
out.println("<br /><center><h1><font color='red'>Book Return Failed !</font></h1></center>");
}
else
{
SQL="DELETE FROM bookissue WHERE bookid="+bookid+" AND memberid="+memberid;
stmt.executeUpdate(SQL);
out.println("<br /><center><h1>Book Return Entry Completed</h1></center>");
}
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</body>
</html>


BookList.jsp

<%@page import="java.sql.*"%>
<html>
<body>
<center><h1>BOOKS</h1>
<table border="3" cellpadding="10" style="font-size:14pt; font-family:Cambria;">
<tr><th>Book ID</th><th>Book Name</th><th>Category</th></tr>
<%
String url="jdbc:mysql://localhost:3306/Library";
String user="Admin";
String password="Admin1234";
String SQL="SELECT * FROM books";
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(SQL);
while(rs.next())
{
out.println("<tr><td>"+rs.getString("bookid")+"</td>");
out.println("<td>"+rs.getString("bookname")+"</td>");
out.println("<td>"+rs.getString("category")+"</td></tr>");
}
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</table></center>
</body>
</html>


MemberList.jsp

<%@page import="java.sql.*"%>
<html>
<body>
<center><h1>MEMBERS</h1>
<table border="3" cellpadding="10" style="font-size:14pt; font-family:Cambria;">
<tr><th>Member ID</th><th>Member Name</th><th>Contact No.</th></tr>
<%
String url="jdbc:mysql://localhost:3306/Library";
String user="Admin";
String password="Admin1234";
String SQL="SELECT * FROM members";
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(SQL);
while(rs.next())
{
out.println("<tr><td>"+rs.getString("memberid")+"</td>");
out.println("<td>"+rs.getString("membername")+"</td>");
out.println("<td>"+rs.getString("contact")+"</td></tr>");
}
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</table></center>
</body>
</html>


BookIssueList.jsp

<%@page import="java.sql.*"%>
<html>
<body>
<center><h1>BOOKS ISSUE</h1>
<table border="3" cellpadding="10" style="font-size:14pt; font-family:Cambria;">
<tr><th>Book ID</th><th>Book Name</th><th>Member ID</th><th>Member Name</th></tr>
<%
String url="jdbc:mysql://localhost:3306/Library";
String user="Admin";
String password="Admin1234";
String SQL="SELECT books.bookid,bookname,members.memberid,membername FROM books,members,bookissue WHERE books.bookid=bookissue.bookid AND members.memberid=bookissue.memberid";
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(SQL);
while(rs.next())
{
out.println("<tr><td>"+rs.getString("bookid")+"</td>");
out.println("<td>"+rs.getString("bookname")+"</td>");
out.println("<td>"+rs.getString("memberid")+"</td>");
out.println("<td>"+rs.getString("membername")+"</td></tr>");
}
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</table></center>
</body>
</html>



ABOUT US

QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries.

Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions.

Moreover, QuestionSolves.com provides solutions to your questions and assignments also.


MORE TOPIC


Windows Command

UNIX Command

IGNOU Assignment Solution

IGNOU Question Paper Solution


WHAT WE DO


Website Devlopment

Training

Home Learning

Provide BCA, MCA Projects

Provide Assignment & Question Paper Solution


CONTACT US


Follow Us