BCSL057 Solved Assignment 2024-25 @BCAcrackers
BCSL057 Solved Assignment 2024-25 @BCAcrackers
in 1
Maximum Marks : 50
Weightage : 25%
Last Dates for Submission : 31stOctober,2024(For July, Session) 30thApril, 2025(For January, Session)
Note:
This assignment has one question of 40 marks. Rest 10 marks are for viva voce. Please go through the guidelines regarding
assignments given in the programme guide for the format of presentation.
Q1.(a) Design and implement a website/web application consisting of three pages having the following layout:
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 2
Create three pages having the same layout as shown in Figure 1. The Top Division contains the following links:
The Information Division of the three pages should be as per the following description:
(i) The Home Page should display the name of the mobile store "Mobile for You". It should display the objectives and
address of the mobile store. (3 Marks)
(ii) The Mobile List Page should be generated by a query to a database "Mobiles" having a single relation Mobile_ram
(Mobile_make, RAM_size). (3 Marks)
You must use JSP to connect to database and display information as:
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 3
Mobile List
You must display at least five mobiles in this list. (18 Marks)
iii) The Comments Page should display a form as shown below : (Please do not write the code for processing or
verification of the form) (6 Marks)
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 4
(b) Create an external CSS file that ensures that format of all the three pages is as per the layout of Figure 1. The
background colour of Link Division should be light green. (10 Marks)
Solution:
For this assignment, I will create a simple web application with three pages: a Home Page, a Mobile List Page (generated using
JSP with a database connection), and a Comments Page with a form. I will also create an external CSS file to ensure that the
layout and design match the description provided, including formatting for the top navigation and background colors.
This page will display the name and objectives of the mobile store "Mobile for You."
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="top">
<a href="index.html">Home</a>
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 5
<a href="comments.html">Comments</a>
</div>
<div id="info">
<p><b>Objectives:</b> To provide the latest mobile phones with the best offers.</p>
</div>
</body>
</html>
This JSP file will connect to the database and display the mobile make and RAM size.
<body>
<div id="top">
<a href="index.html">Home</a>
<a href="mobileList.jsp">Mobile List</a>
<a href="comments.html">Comments</a>
</div>
<div id="info">
<h1>Mobile List</h1>
<table border="1">
<tr>
<th>Make</th>
<th>RAM (GB)</th>
</tr>
<%
// JDBC connection parameters
String dbURL = "jdbc:mysql://localhost:3306/mobiles";
String dbUser = "root"; // Replace with your MySQL username
String dbPass = ""; // Replace with your MySQL password
try {
// Load MySQL JDBC Driver
Class.forName("com.mysql.cj.jdbc.Driver");
%>
<tr>
<td><%= rs.getString("Mobile_make") %></td>
<td><%= rs.getInt("RAM_size") %></td>
</tr>
<%
}
// Close the connection after use
rs.close();
stmt.close();
con.close();
} catch (Exception e) {
// Display error message in case of issues
out.println("Error: " + e.getMessage());
e.printStackTrace();
}
%>
</table>
</div>
</body>
</html>
This page contains a simple form for user comments and rating of mobile phones.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
<title>Comments</title>
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 8
</head>
<body>
<div id="top">
<a href="index.html">Home</a>
<a href="mobileList.jsp">Mobile List</a>
<a href="comments.html">Comments</a>
</div>
<div id="info">
<h1>Comment</h1>
<form action="submitComments.jsp" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br><br>
<label>Rate the mobile:</label><br>
<input type="radio" id="verygood" name="rating" value="Very good">
<label for="verygood">Very good</label><br>
<input type="radio" id="good" name="rating" value="Good">
<label for="good">Good</label><br>
<input type="radio" id="notgood" name="rating" value="Not so good">
<label for="notgood">Not so good</label><br><br>
<input type="submit" value="Submit">
</form>
</div>
</body>
</html>
This CSS file will ensure the layout and design match the figure.
body {
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 9
#top {
background-color: lightgreen;
padding: 10px;
text-align: center;
#top a {
margin: 0 15px;
padding: 10px;
background-color: white;
text-decoration: none;
font-size: 14px;
}
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 10
#top a:hover {
background-color: #ddd;
#info {
margin: 20px;
padding: 20px;
background-color: #f9f9f9;
table {
width: 50%;
border-collapse: collapse;
}
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 11
table, th, td {
th {
background-color: #f2f2f2;
font-weight: bold;
font-size: 12pt;
td {
font-size: 11pt;
text-align: center;
tr:nth-child(even) {
background-color: lightblue;
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 12
tr:nth-child(odd) {
background-color: lightpink;
In my case the webapp directory name is ‘work_shop’ and the path is the following:
C:\xampp\tomcat\webapps\work_shop
Here's the directory structure for the required files for our project:
C:\xampp\tomcat\webapps\work_shop
├── index.html
├── comments.html
├── mobileList.jsp
├── styles.css
└── WEB-INF
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 13
└── web.xml
To run this project, create a database called "mobiles" with the following table structure:
INSERT INTO Mobile_ram VALUES ('Samsung', 2), ('Apple', 4), ('Xiaomi', 6), ('OnePlus', 8), ('Oppo', 3);
Once the database is created, the JSP page will retrieve the mobile data and display it on the webpage.
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 15
Screenshots of Output:
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 16
BCSL-057 Solved Assignment 2024-25 | learningscience.co.in 17