BCS053
BCS053
Question 1:
a) Features of Blogging, Mashups, and Rich Internet Applications
Blogging:
• Content Creation: Allows users to create and publish their own content, such as articles, blog
posts, and multimedia.
• Community Building: Enables users to connect with others who share similar interests and engage
in discussions.
• SEO Benefits: Can improve search engine rankings through effective content creation and
optimization.
Mashups:
• Integration: Combines data from multiple sources to create new applications or services.
• Customization: Allows users to personalize their online experiences by combining different
elements.
• Innovation: Facilitates the development of innovative solutions by leveraging existing
technologies and data.
Rich Internet Applications (RIAs):
• Interactivity: Offers a more interactive and engaging user experience compared to traditional web
applications.
• Offline Functionality: Enables some applications to function without a constant internet
connection.
• Desktop-like Features: Provides features similar to desktop applications, such as drag-and-drop,
real-time updates, and offline data storage.
How these technologies are useful: These technologies can be used for various purposes, including:
• Personal Expression: Blogging allows individuals to share their thoughts, experiences, and ideas
with the world.
• Business: Mashups can be used to create innovative business applications, while RIAs can enhance
customer experiences.
• Education: Blogging and RIAs can be used to create educational content and interactive learning
experiences.
• Social Networking: Mashups and RIAs can be used to create social networking platforms and
tools.
b) HTML, CSS, and JavaScript Code for Online Library Membership
Form
HTML Code:
HTML
<!DOCTYPE html><html><head><title>Online Library Membership Form</title>
<linkrel="stylesheet"href="styles.css"></head><body><h1>Online Library Membership Form</h1>
<form><labelfor="name">Name:</label><inputtype="text"id="name"name="name"><br><br>
<labelfor="aadhar">Aadhar Number:</label><inputtype="number"id="aadhar"name="aadhar"><br>
<br><label for="membershipType">Membership Type:</label>
<select id="membershipType" name="membershipType">
<option value="Student">Student</option>
<option value="Faculty">Faculty</option>
<option value="Staff">Staff</option>
<option value="Other">Other</option>
</select><br><br>
Bcs-053 Page 1
</select><br><br>
<labelfor="yearOfMembership">Year of Membership:</label>
<inputtype="number"id="yearOfMembership"name="yearOfMembership"><br><br>
<labelfor="previousMember">Were you a member earlier?</label>
<inputtype="radio"id="previousMemberYes"name="previousMember"value="Yes">Yes
<inputtype="radio"id="previousMemberNo"name="previousMember"value="No">No<br><br>
<labelfor="description">Description of services expected:</label><br>
<textareaid="description"name="description"></textarea><br><br>
<inputtype="submit"value="Submit"></form></body></html>
JavaScript Code:
JavaScript
functionvalidateForm() {
varname = document.getElementById("name").value;
varaadhar = document.getElementById("aadhar").value;
varmembershipType = document.getElementById("membershipType").value;
varyearOfMembership = document.getElementById("yearOfMembership").value;
vardescription = document.getElementById("description").value;
if(name == ""|| aadhar == ""|| membershipType == ""|| yearOfMembership == ""|| description == "") {
alert("Please fill in all the required fields.");
returnfalse;
}
}
Screenshot:
Bcs-053 Page 2
}
th{
text-align: left;
padding: 8px;
background-color: #4CAF50;
color: white;
font-size: 12pt;
font-weight: bold;
}
td{
text-align: left;
padding: 8px;
font-size: 11pt;
font-family: Arial;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
tr:nth-child(odd) {
background-color: #d3d3d3;
}
div.theory-courses, div.practical-courses{
background-color: lightyellow;
padding: 10px;
}
ol{
font-family: Times New Roman;
font-size: 11pt;
}
</style></head><body><h2>BCA Course List</h2><table><tr><th>Serial Number</th><th>Course
Code</th><th>Course Title</th><th>Course Credits</th><th>Course Type</th></tr><tr><td>1</td>
<td>BCA101</td><td>Introduction to Computer Science</td><td>3</td><td>Theory</td></tr></table>
<divclass="theory-courses"><h2>Theory Courses</h2><ol><li>Introduction to Computer Science</li>
</ol></div><divclass="practical-courses"><h2>Practical Courses</h2><ol><li>Programming
Fundamentals Lab</li></ol></div></body></html>
Screenshot:
DTD (students.dtd):
<!ELEMENT students (student+)>
<!ELEMENT student (name, programme, duration, courses)>
<!ATTLIST student enrolmentNumber CDATA #REQUIRED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT programme (#PCDATA)>
Bcs-053 Page 3
<!ELEMENT programme (#PCDATA)>
<!ELEMENT duration (#PCDATA)>
<!ELEMENT courses (course+)>
<!ELEMENT course (#PCDATA)>
e) JavaScript Code for Event Handling
JavaScript
functiondisplayText() {
varwelcomeText = document.getElementById("welcomeText");
if(welcomeText.innerHTML === "Welcome to JavaScript Event Demonstration") {
welcomeText.innerHTML = "We just demonstrated the click Event";
} else{
welcomeText.innerHTML = "Welcome to JavaScript Event Demonstration";
}
}
// Add event listener to the text elementvarwelcomeText = document.getElementById("welcomeText");
welcomeText.addEventListener("click", displayText);
Bcs-053 Page 4
<select name="choice">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
</select>
Question 2:
a) Explanations
i) Static web pages and Dynamic web pages
• Static web pages: These pages are created once and remain unchanged unless manually edited.
They are typically HTML files that are served directly to the client's browser.
• Dynamic web pages: These pages are generated on-the-fly by a web server, based on user input,
database queries, or other factors. They can provide a more personalized and interactive
experience for users.
Ntier architecture
iii) Tools for server-side scripting
• PHP: A popular general-purpose scripting language.
• ASP.NET: Microsoft's web development framework.
• Java Server Pages (JSP): A technology for creating dynamic web content using Java.
• Python: A versatile programming language often used for web development.
• Ruby on Rails: A full-stack web development framework.
iv) HTTP primitives
HTTP primitives are the basic operations that can be performed using the HTTP protocol. They include:
• GET: Retrieves data from a server.
• POST: Sends data to a server.
• PUT: Updates data on a server.
• DELETE: Deletes data from a server.
• HEAD: Retrieves the header information of a resource without the body.
• OPTIONS: Retrieves the allowed HTTP methods for a resource.
• TRACE: Echoes back the request to the client.
• CONNECT: Establishes a tunnel to a server.
v) Web Container
A web container is a software component that provides a runtime environment for executing web
applications. It handles tasks such as servlet lifecycle management, HTTP request and response
processing, and session management. Examples of web containers include Tomcat, Jetty, and GlassFish.
b) JSP Examples
i) include and taglib directives
• include directive: Includes the content of another file into the current JSP page.
Java
<%@ include file="header.jsp"%>
• taglib directive: Declares a custom tag library to be used in the JSP page.
Java
<%@ taglib prefix="c"uri="http://java.sun.com/jsp/jstl/core"%>
Bcs-053 Page 5
<%@ taglib prefix="c"uri="http://java.sun.com/jsp/jstl/core"%>
ii) JSP scriptlet to display a list of first 10 positive odd numbers
Java
<%
for(inti = 1; i <= 10; i++) {
if(i % 2!= 0) {
out.println(i + "<br>");
}
}
%>
Bcs-053 Page 6
d) Book Sales System
Database Schema:
SQL
CREATETABLEBook (
ISBNnumber VARCHAR(13) PRIMARYKEY,
Title VARCHAR(100),
FirstAuthor VARCHAR(50),
YearOfPublication INT,
CopiesAcquired INT);
CREATETABLESales (
ISBNnumber VARCHAR(13),
PersonName VARCHAR(50),
NumberofCopiesSold INT,
FOREIGNKEY (ISBNnumber) REFERENCESBook(ISBNnumber)
);
JSP Program:
Java
<%
// Get ISBNnumber from requestString isbn = request.getParameter("isbn");
// Retrieve book information from database// ... (JDBC code to query the Book table)// Display book
information and sales history%>
Webpage:
Bcs-053 Page 7
out.println("Person Name: "+ personName);
out.println("Number of Copies Sold: "+ numberOfCopiesSold);
out.println("<br>");
}
} else{
out.println("Book not found.");
}
conn.close();
} catch(Exception e) {
e.printStackTrace();
}
%>
Webpage:
HTML
<formaction="bookSales.jsp"method="post">ISBN Number: <inputtype="text"name="isbn"><br>
<inputtype="submit"value="Search"></form>
Database:
Bcs-053 Page 8