0% found this document useful (0 votes)
9 views52 pages

Data Science and Java Programming Curriculum

Saraswati College of Engineering aims to be a globally recognized autonomous institute focused on engineering education, research, and skill enhancement. The Department of Data Science emphasizes quality education, research, and ethical values to develop competent professionals. The curriculum includes programming, web development, and practical experiments to equip students with necessary skills and knowledge for real-world challenges.

Uploaded by

gauri.deshpande
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views52 pages

Data Science and Java Programming Curriculum

Saraswati College of Engineering aims to be a globally recognized autonomous institute focused on engineering education, research, and skill enhancement. The Department of Data Science emphasizes quality education, research, and ethical values to develop competent professionals. The curriculum includes programming, web development, and practical experiments to equip students with necessary skills and knowledge for real-world challenges.

Uploaded by

gauri.deshpande
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

College of

Department of Computer SɅRɅSWɅTI Engineering


Engineering (DS)

Saraswati College of Engineering

Vision

“To be globally recognized as an autonomous Institute in engineering education with


an emphasis on academics, research and skills enhancement to create innovators and
future leaders for Industry and societal needs.”

Mission

1. To provide theoretical and practical knowledge through quality teaching learning to develop
competent engineers.
2. To create an ambience that facilitates research, entrepreneurship and collaborations leading
to emergence of innovators and future leaders.
3. To develop a student-centric approach that inculcates moral, ethical values and leadership
skills for holistic development.
4.

Department of Data Science

Vision:

To be a renowned institute in data science education, driving academic excellence,

research, and skill development to produce innovators and future leaders for societal

aspects

Mission:

 To deliver quality theoretical and practical data science education, developing skilled

professionals who can solve complex challenges.

 To foster an environment that promotes research, innovation, and entrepreneurship in

data science, empowering future leaders and innovators of society.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

 To instill ethical values, leadership skills, and fosters holistic development in data

science professionals.

Program Educational Objectives (PEO)

PEO 1: To develop globally competent graduates with a strong foundation in data


science principles for analyzing, designing, and creating innovative solutions to
real-world problems.

PEO 2: To inculcate research attitude in multidisciplinary domains with experiential


learning and developing entrepreneurship skills.

PEO 3: To prepare graduates as ethical and committed professionals with a sense of


societal and environmental responsibilities.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Program Outcomes (PO)

PO 1: Engineering knowledge: Apply knowledge of mathematics, natural science, computing,


engineering fundamentals and an engineering specialization as specified in WK1 to WK4
respectively to develop to the solution of complex engineering problems.
PO 2: Problem Analysis: Identify, formulate, review research literature and analyze complex
engineering problems reaching substantiated conclusions with consideration for sustainable
development. (WK1 to WK4)
PO 3: Design/Development of Solutions: Design creative solutions for complex engineering
problems and design/develop systems/components/processes to meet identified needs with
consideration for the public health and safety, whole-life cost, net zero carbon, culture, society
and environment as required. (WK5)
PO 4: Conduct Investigations of Complex Problems: Conduct investigations of complex
engineering problems using research-based knowledge including design of experiments,
modelling, analysis & interpretation of data to provide valid conclusions. (WK8)
PO 5: Engineering Tool Usage: Create, select and apply appropriate techniques, resources and
modern engineering & IT tools, including prediction and modelling recognizing their limitations
to solve complex engineering problems. (WK2 and WK6)
PO 6: The Engineer and The World: Analyze and evaluate societal and environmental aspects
while solving complex engineering problems for its impact on sustainability with reference to
economy, health, safety, legal framework, culture and environment. (WK1, WK5, and WK7).
PO 7: Ethics: Apply ethical principles and commit to professional ethics, human values,
diversity and inclusion; adhere to national & international laws. (WK9)
PO 8: Individual and Collaborative Team work: Function effectively as an individual, and as
a member or leader in diverse/multi-disciplinary teams.(WK9)
PO 9: Communication: Communicate effectively and inclusively within the engineering
community and society at large, such as being able to comprehend and write effective reports
and design documentation, make effective presentations considering cultural, language, and
learning differences
PO 10: Project Management and Finance: Apply knowledge and understanding of
engineering management principles and economic decision-making and apply these to one’s
own work, as a member and leader in a team, and to manage projects and in multidisciplinary
environments.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

PO 11: Life-Long Learning: Recognize the need for, and have the preparation and ability for i)
independent and life-long learning ii) adaptability to new and emerging technologies and iii)
critical thinking in the broadest context of technological change. (WK8)

Syllabus
Full Stack Java Programming
Sr. Name of Module Detailed Content Hr CO
No. s Mapping

0 Prerequisite Basic Programming constructs in C & Python.

I Introduction OOP concepts: Objects, class, Encapsulation, 4 LO1


to OOP in Abstraction, Inheritance, Polymorphism,
Java message passing. Branching and looping.
Class, object, data members, member functions
Constructors, types, static members and
functions Method overloading Input and output
functions in Java, Buffered reader class,
scanner class,Packages in java, types, user
defined packages.
Self-learning Topics: Array and Vectors inJava

II Inheritance Inheritance: Types of inheritance, Method 3 LO2


& overriding, super, abstract class and abstract
Exception method, final, Multiple inheritances using
Handling interface, extends keyword.
Exception Handling: try, catch, finally, throw
and throws, Multiple try and catch blocks, user
defined exception.
Self-learning Topics: Multithreading in Java

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

III Client and Java Database Connectivity (JDBC):JDBC 5 LO3


Server Side architecture and drivers Connecting to
Programming databases (MySQL, Oracle, etc.) Executing
SQL queries using Java Statements.
Client Side Scripting: HTML: Elements,
Attributes, Head, Body, Hyperlink, Formatting,
Images, Tables, List, Frames, Forms.
CSS3:Syntax, Inclusion, Color, Background,
Fonts, Tables, lists,CSS3 selectors.
Server side programming in Java:
Introduction of Servlet, Servlet lifecycle,
Servlet Request, Servlet Response, Servlet
Context, HTTP Sessions, Handling forms and
user inputs, Session management. Introduction
to Java Server Pages, JSP architecture and
page directives, Components of a JSP,
Scripting elements and Standard actions,
Method Definitions, JSTL
Self-learning Topics: Database Connectivity in
Servlets and Implement JSP with JDBC to fetch
data from a database

IV .
Java Script: Introduction to JavaScript: 5
Fundamentals
Conditionals Statements, Loops, Functions,
of Java Script
Arrays, Objects, Control Flow, Math Function,
Browser Object Model, Document Object
Model.
DOM Manipulation: Introduction to the
DOM, Defining the DOM, LO4
Defining DOM, Dom Tree, Language-Specific
DOMs, Accessing relative nodes, Checking the

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

node type, Dealing with attributes, Creating


and manipulating nodes, DOM HTML
Features, Attributes as properties, Table
methods, DOM Traversal, NodeIterator,
TreeWalker, Selector methods, Detecting
DOM Conformance, DOM style methods,
Custom tooltips, Collapsible sections,
Accessing style sheets
Events, Fetch & Callbacks: Event Flow, Event
Handlers/Listeners, The Event Object, Types of
Events, Cross-Browser Events, HTTP
Responses, Working with JSON data.
Self-learning Topics: AJAX

V Web Design Pattern: Understanding MVC 5 LO5


Programming architecture Implementing MVC with servlets
using React and JSP Developing a complete web
application Solving company’s use cases.
React Framework: Introduction to React JS,
Components and Elements of React, Rendering
Components, React State and Props, Events,
Hooks, Routing Conditional Rendering, Lists
and Keys, Forms, create a single page
application using React.
Self-learning Topics: Flux and Redux

VI Applications of Spring Framework: Introduction to Micro 4 LO6


Spring Frame services, Basics Dependency injection and
work inversion of control (IoC), Spring annotations,
Database integration and Aspect-oriented
programming (AOP) with spring, creating
spring boot applications, Building REST ful

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

APIs with spring boot.


Self-learning Topics:Real-timeApplications on
Spring Framework

Course objectives:

 Familiarize with Basic OOP concepts in Java.

 Understand the concepts of inheritance and exceptions in java.

 Design and implement programs involving Client and Server Side Programming.

 Describe and utilize the functioning of DOM and Java script.

 Study different design patterns in web programming and understand the working of react
framework.

 To describe the Spring Framework and implement the related case studies.

Course outcomes:

At the end of the course,the students should be able to:

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

 Understand and apply the fundamentals of Java Programming and Object-Oriented


Programming.

 Elaborate and design applications using Client and Server Side Programming.

 Understand the concepts in Java Script for interactive Web Development.

 Implement the real-world application development in web programming using React.

 Design and Develop Enterprise-Level Applications Using the Spring Framework.

LIST OF EXPERIMENTS
Expt. No. Name of the Experiment

1. Write a Java program to implement class and object

2. Write a Java program to method and constructor overloading

3. Write a Java program to implement Inheritance and exception


handling
4. Write a Java program to implement website using
Html and CSS
5.
Write a Java program to implement mail validation using
Java Script
6. Write a Java program to implement document object model to change the

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

background color of the web page automatically after every 5 seconds


7.
Write a Java program to implement servlet

8. Write a Java program to implement JSP implicit and explicit object

9. Implementation of Java Database Connectivity

10. Design a web page using react

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

H/W Requirement RAM Minimum 4 GB,Minimum 40 GB free space,Keyboard,


Mouse,Monitor

S/W Requirement JDK 1.8 and above, Notepad,Net Beans 8.0.1, HTML,CSS,React, Online
Java Compiler

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No.1

Aim: Write a Java program to implement class and object

Resources Required:

· Java Development Kit (JDK)

· Text Editor (e.g., Notepad++) or IDE (e.g., Eclipse, IntelliJ IDEA, NetBeans)

· Command-line terminal or Java compiler

Theory:

In Java, a class is a blueprint for creating objects. A class contains fields (variables) and

methods (functions) that define the behavior of an object. An object is an instance of a class.

Key Concepts:

 A class defines structure and behavior.

 An object is created using the new keyword.

 Objects can access fields and methods of the class.

Example:

If you define a class called Car, you can create multiple Car objects with different properties.

Class Syntax

class ClassName {

// Fields (variables)

dataType variableName;

// Methods

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

returnType methodName() {

// method body

Object Syntax:

ClassName objectName = new ClassName();

Source Code:

Source Code:
// Class definition
class Student {
// Data members (fields)
String name;
int age;

// Method to display student details


void displayInfo() {
[Link]("Name: " + name);
[Link]("Age: " + age);
}
}

// Main class
public class Main {
public static void main(String[] args) {
// Creating an object of Student

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Student student1 = new Student();

// Assigning values to object


[Link] = "Alice";
[Link] = 20;

// Calling method using object


[Link]();
}
}

Output:

Name: Alice

Age: 20

Conclusion:

The Java program successfully demonstrates the implementation of class and object. We

defined a class Student with fields and methods, then created an object student1 to access

those members. This illustrates the object-oriented concept of encapsulation in Java.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No.2

Aim: Write a Java program to method and constructor overloading

Resources Required:

 · Java Development Kit (JDK)

 · Text Editor (e.g., Notepad++) or IDE (e.g., Eclipse, IntelliJ IDEA, NetBeans)

 · Command-line terminal or Java compiler

Theory:

Java is a high-level, object-oriented, platform-independent programming language. It provides

many powerful features that make it widely used in software development. Encapsulation,

Inheritance, Polymorphism and abstraction are main fetures of Java.

Polymorphism means many forms It allows the same function name to behave differently based
on context (i.e., number or type of arguments, object type, etc.).

Types of Polymorphism in Java

1. Compile-Time Polymorphism (Static Binding)

Achieved using:

 Method Overloading

 Constructor Overloading

2. Run-Time Polymorphism (Dynamic Binding)

Achieved using:

 Method Overriding (with inheritance)

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Method Overloading (Compile-Time Polymorphism) having multiple methods with the same

name but different parameter lists in the same class is called method overloading.

Syntax:

class ClassName {

void display() { }

void display(int a) { }

void display(String s) { }

Constructor Overloading

Constructor Overloading (Compile-Time Polymorphism) Having multiple constructors in the

same class with different parameter lists is called constructor overloading.

Syntax:

class ClassName {

ClassName() { }

ClassName(int a) { }

ClassName(String s) { }

Source Code:

1. Constructor Overloading:

class Student {

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Student() {

[Link]("Default Constructor");

Student(String name) {

[Link]("Name: " + name);

Student(int age, String course) {

[Link]("Age: " + age + ", Course: " + course);

public static void main(String[] args) {

Student s1 = new Student();

Student s2 = new Student("Gauri");

Student s3 = new Student(20, "Java");

}
Output:

Default Constructor

Name: Gauri

Age: 20, Course: Java

2. Method Overloading:

class Calculator {

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

void add(int a, int b) {

[Link]("Sum: " + (a + b));

void add(double a, double b) {

[Link]("Sum: " + (a + b));

void add(String a, String b) {

[Link]("Concatenation: " + (a + b));

public static void main(String[] args) {

Calculator c = new Calculator();

[Link](5, 10); // Calls int version

[Link](2.5, 3.5); // Calls double version

[Link]("Hello", "Java"); // Calls String version

Output:

Sum: 15

Sum: 6.0

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Concatenation: HelloJava

Conclusion:

This Java program successfully demonstrates the implementation of constructor and method

overloading.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No 3
Aim: Write a Java program to implement Inheritance and exception handling

Resources Required:

 · Java Development Kit (JDK)


 · Text Editor (e.g., Notepad++) or IDE (e.g., Eclipse, IntelliJ IDEA, NetBeans)
 · Command-line terminal or Java compiler

Theory:
1. Inheritance in Java:
Inheritance is one of the core principles of Object-Oriented Programming (OOP). It allows a
class (known as a subclass or child class) to acquire the properties and behaviors (fields and
methods) of another class (called a superclass or parent class).
Inheritance promotes code reusability, method overriding, and helps in establishing a natural
hierarchy between classes.
Types of Inheritance in Java:
Single Inheritance
➤ One class inherits from one superclass.
Example: class B extends A {}
Multilevel Inheritance
➤ A class inherits from a derived class, forming a chain.
Example: class C extends B extends A {}
Hierarchical Inheritance
➤ Multiple classes inherit from a single parent class.
Example:
class A {}
class B extends A {}
class C extends A {}

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Java does not support multiple inheritance using classes (to avoid ambiguity), but it is
supported using interfaces.

2. Exception Handling in Java:


Exception Handling is a mechanism to handle runtime errors, ensuring the normal flow of the
application. An exception is an unwanted or unexpected event that occurs during program
execution, such as dividing by zero or accessing an invalid array index.
Java provides robust exception-handling tools to catch and respond to these errors.
1. Types of Exceptions:
Checked Exceptions
➤ Checked at compile time (e.g., IOException, SQLException).
Unchecked Exceptions
➤ Occur at runtime (e.g., ArithmeticException, NullPointerException,
ArrayIndexOutOfBoundsException).
Errors
➤ Serious problems that applications should not try to catch (e.g., OutOfMemoryError)

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Source Code: Inheritance

// Superclass

class Vehicle {

String brand;

Vehicle(String brand) {

[Link] = brand;

void showBrand() {

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

[Link]("Vehicle Brand: " + brand);

// Subclass

class Car extends Vehicle {

String model;

Car(String brand, String model) {

super(brand); // Call constructor of superclass

[Link] = model;

void showModel() {

[Link]("Car Model: " + model);

public class InheritanceDemo {

public static void main(String[] args) {

Car myCar = new Car("Toyota", "Corolla");

[Link](); // Inherited method

[Link](); // Own method

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Output:

Vehicle Brand: Toyota

Car Model: Corolla

Source Code: Exception Handling

public class ExceptionHandlingDemo {

public static void main(String[] args) {

try {

int a = 10;

int b = 0;

int result = a / b; // This will throw ArithmeticException

[Link]("Result: " + result);

} catch (ArithmeticException e) {

[Link]("Exception caught: Division by zero is not allowed.");

} finally {

[Link]("Finally block executed.");

[Link]("Program continues after exception handling.");

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Output:

Exception caught: Division by zero is not allowed.

Finally block executed.

Program continues after exception handling.


Conclusion:
This Java program successfully demonstrates the implementation of inheritance and
exception handling.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No 4
Aim: Write a Java program to implement website using Html and CSS

Resources Required:

· Java Development Kit (JDK)

· Text Editor (e.g., Notepad++) or IDE (e.g., Eclipse, IntelliJ IDEA, NetBeans)

· Command-line terminal or Java compiler


Theory:
Web development is broadly divided into two parts:
Front-end (client-side) → What the user sees and interacts with (HTML, CSS,
JavaScript).
Back-end (server-side) → What happens behind the scenes (Java, PHP, Python,
databases, etc.)

HTML (HyperText Markup Language):


HTML is the backbone of every [Link] defines the structure and layout of a webpage
by using different tags and elements.
Examples:
<h1> to <h6> for headings
<p> for paragraphs
<a> for hyperlinks
<ul> or <ol> for lists
<div> and <section> for grouping content
HTML is not a programming language; it is a markup language that tells the browser
how to display content.
CSS (Cascading Style Sheets):
CSS is used to style the HTML structure.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

It controls how the webpage looks: fonts, colors, backgrounds, spacing, borders, and
layout.
CSS follows the concept of separation of concerns → HTML defines structure, CSS
defines style.
CSS can be applied in three ways:
Inline CSS – inside an element tag
Internal CSS – inside <style> in the head section
External CSS – stored in a separate .css file and linked with <link>
CSS makes the website attractive, user-friendly, and responsive (adjustable on different
devices)
HTML + CSS Together:
When HTML and CSS are combined, we get a complete and styled webpage. For example:
HTML defines a header with the tag <header>.
CSS styles it by giving background color, text alignment, and padding.
This separation makes websites easier to design and maintain.

Source Code:
<!DOCTYPE html>
<html>
<head>
<title>My Simple Website</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f6f9;
color: #333;
}
header {

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

background-color: #4CAF50;
color: white;
padding: 20px;
text-align: center;
}
main {
padding: 20px;
max-width: 800px;
margin: auto;
}
h1, h2 {
color: #4CAF50;
}
a{
color: #4CAF50;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
footer {
text-align: center;
background: #333;
color: white;
padding: 10px;
margin-top: 20px;
}
ul {
list-style-type: square;
padding-left: 20px;

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

}
</style>
</head>
<body>
<header>
<h1>Welcome to My Website</h1>
<p>This is a very simple website made with HTML + CSS</p>
</header>

<main>
<h2>About</h2>
<p>I am learning HTML and CSS. This is my first styled web page.</p>

<h2>Links</h2>
<ul>
<li><a href="[Link] to Google</a></li>
<li><a href="[Link] to Wikipedia</a></li>
</ul>

<h2>Contact</h2>
<p>You can email me at <a
href="[Link]
</main>

<footer>
<p>&copy; 2025 My Simple Website</p>
</footer>
</body>
</html>

Output:

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Conclusion:
This Java program successfully demonstrates the implementation of website using HTML
and CSS.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No 5
Aim: Write a Java program to implement mail validation using Java Script

Resources Required:

· Java Development Kit (JDK)


· Text Editor (e.g., Notepad++) or IDE (e.g., Eclipse, IntelliJ IDEA, NetBeans)
· Command-line terminal or Java compiler

Theory:

JavaScript is a high-level, interpreted, object-oriented programming language primarily used


for adding interactivity and dynamic behavior to websites. It was developed by Brendan Eich
in 1995 at Netscape and has since become one of the core technologies of the web, alongside
HTML and CSS.

Features of JavaScript

 Client-Side Execution: Runs directly in the user’s browser without needing server
interaction.
 Interpreted Language: Does not require compilation; executed line by line.
 Lightweight & Fast: Designed for quick execution inside web pages.
 Object-Oriented: Uses objects and prototypes (not classical classes like Java, though ES6
introduced class syntax).
 Event-Driven: Reacts to user actions like clicks, inputs, mouse movements, etc.
 Platform Independent: Runs on any operating system and browser.
 Case-Sensitive: Identifiers (variable names, functions) are case-sensitive.

Table: Explanation of Syntax Used in Program


Syntax / Keyword Meaning / Use
<!DOCTYPE html> Declares the document type as HTML5.
<html> ... </html> Root element of the HTML document.
<head> ... </head> Contains page metadata, title, and script code.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Syntax / Keyword Meaning / Use


<body> ... </body> Contains visible content (button for email input).
<script> ... </script> Section where JavaScript code is written.
function validateEmail() Declares a user-defined function named validateEmail.
{ ... } (curly braces) Groups multiple statements inside a function or control block.
Declares a variable email and assigns input value entered by the
let email = prompt()
user.
Declares a constant variable to store the regex (cannot be
const emailPattern = ...
changed).
/^[^\s@]+@[^\s@]+\.[^\s@]+
Regular Expression (Regex) pattern for validating email format.
$/
while (true) Infinite loop that keeps executing until break is used.
if (condition) Checks if a condition is true; executes block if true.
else { ... } Executes alternative block if the if condition is false.
Tests whether the input matches the regex pattern (returns
[Link](email)
true/false).
alert("message") Displays a popup alert box with a message.
break Exits the loop immediately.
<button onclick="..."> Creates a clickable button and calls a function when clicked.

Source Code:
<!DOCTYPE html>
<html>
<head>
<title>Email Validation</title>
<script>
function validateEmail() {
let email = prompt("Please enter your email address:");

// Regex for simple email validation


const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

// Keep asking until a valid email is entered


while (true) {
if ([Link](email)) {

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

alert("Email is valid: " + email);


break;
} else {
alert(" Invalid email! Please enter a valid format (example: user@[Link]).");
email = prompt("Re-enter your email address:");
}
}
}
</script>
</head>
<body>
<h2>Email Validation Example</h2>
<button onclick="validateEmail()">Enter Email</button>
</body>
</html>

Output:

Conclusion:
This Java program successfully demonstrates the implementation of Email Validation using
Java Scipt.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No 6
Aim: Write a Java program to implement document object model to change the background color
of the web page automatically after every 5 seconds

Resources Required:

· Java Development Kit (JDK)

· Text Editor (e.g., Notepad++) or IDE (e.g., Eclipse, IntelliJ IDEA, NetBeans)

· Command-line terminal or Java compiler


Theory:
The Document Object Model (DOM) is a programming interface for HTML and XML
documents. It represents the page so that programs can manipulate the structure, style, and
content dynamically. Through the DOM, scripts can access and update the content, structure,
and styling of a webpage while it is being displayed in the browser.

In this program, JavaScript (embedded within an HTML file) is used to manipulate the DOM.
The document object in JavaScript represents the entire HTML page. By accessing
[Link], we can modify the background color property of the webpage.

The program defines an array of colors and uses a timer function setInterval() to automatically
change the background color every 5 seconds. Each time the timer triggers, the DOM is updated
by setting a new background color, creating a dynamic and visually interactive effect on the
webpage.

Source Code:

<!DOCTYPE html>

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

<html>

<head>

<title>Auto Background Color Change</title>

<script type="text/javascript">

var colors = ["#FFB6C1", "#ADD8E6", "#90EE90", "#FFD700", "#FF7F50"];

var index = 0;

function changeColor() {

[Link] = colors[index];

index = (index + 1) % [Link];

setInterval(changeColor, 5000); // Change every 5 seconds

</script>

</head>

<body>

<h2 style="text-align:center;">Background changes every 5 seconds</h2>

</body>

</html>

Output:

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Conclusion:

This Java program successfully demonstrates document object model to change the background
color of the web page automatically after every 5 seconds

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No 7

Aim: Write a Java program to implement servlet


Resources Required:

· Java Development Kit (JDK)

· Text Editor (e.g., Notepad++) or IDE (e.g., Eclipse, IntelliJ IDEA, NetBeans)

· Command-line terminal or Java compiler

Theory:

Java Servlet is a Java program that runs on a Java-enabled web server or application server. It handles
client requests, processes them and generates responses dynamically.
Features
 Servlets work on the server side.
 Servlets are capable of handling complex requests obtained from the web server.
 Generate dynamic responses efficiently.
Types of Servlets
1. GenericServlet
It’s an abstract class that implements the Servlet interface.
Protocol-independent (does not depend on HTTP).
Provides basic lifecycle methods (init(), destroy()) and the main method service(ServletRequest
req, ServletResponse res).

2. HttpServlet
Extends GenericServlet.
Specifically designed for handling HTTP requests and responses.

Provides methods for each HTTP method:

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

 doGet() for GET requests


 doPost() for POST requests
 doPut(), doDelete(), doHead(), etc.

Source Code: Generic Servlet

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

/**
*
* @author DS
*/
public class MyGenericServlet extends HttpServlet {

@Override
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException {

// Set the content type of the response


[Link]("text/html");

// Write HTML content to the response

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

try ( // Get a PrintWriter to write the response


PrintWriter out = [Link]()) {
// Write HTML content to the response
[Link]("<html>");
[Link]("<head><title>Generic Servlet Example</title></head>");
[Link]("<body>");
[Link]("<h2>Hello from MyGenericServlet!</h2>");
[Link]("<p>This is a simple generic servlet.</p>");
[Link]("</body>");
[Link]("</html>");

// Close the PrintWriter


}
}
}

Source Code: Http Servlet


import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class MyHttpServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
[Link]("text/html");
[Link]().println("<h1>Hello from HTTP Servlet (GET)!</h1>");
}

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
[Link]("text/html");
[Link]().println("<h1>Hello from HTTP Servlet (POST)!</h1>");
// Process form data, etc.
}
}
Output:

generic Servlet

http Servlet

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Conclusion:
This Java program successfully demonstrates servlet implementation.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No 8

Aim: Write a Java program to implement JSP implicit and explicit object
Resources Required:

· Java Development Kit (JDK)

· Text Editor (e.g., Notepad++) or IDE (e.g., Eclipse, IntelliJ IDEA, NetBeans)

· Command-line terminal or Java compiler

Theory:

JavaServer Pages (JSP) is a server-side technology that creates dynamic web applications. It
allows developers to embed Java code directly into HTML pages and it makes web development
more efficient.

JSP is an advanced version of Servlets. It provides enhanced capabilities for building scalable
and platform-independent web pages.

Features :
 It is platform-independent; we can write once, run anywhere.
 It simplifies database interactions for dynamic content.
 It contains predefined objects like request, response, session and application, reducing
development time.
 It has built-in mechanisms for exception and error management.
 It supports custom tags and tag libraries

JSP Implicit object

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

These are predefined Java objects provided by the JSP container, offering direct access to
fundamental web components
1. request:Represents the HttpServletRequest object, providing access to client request data,
parameters, and attributes.
2. response:Represents the HttpServletResponse object, used for sending responses back to the
client, setting headers, and managing output.
3. out:Represents the JspWriter object, used for writing content directly to the response stream
that will be sent to the client.
4. session:Represents the HttpSession object, used for managing user-specific data across
multiple requests within a single session.
5. application:Represents the ServletContext object, providing access to application-wide data
and resources shared across all users and sessions.
6. config:Represents the ServletConfig object, used to access initialization parameters defined
for the JSP or servlet.
7. pageContext:Represents the PageContext object, providing access to all other implicit
objects and managing attributes within different scopes (page, request, session, application).
8. page:Represents the current JSP page instance (equivalent to this in a Java class).
9. exception:Represents the Throwable object, available only in error pages, providing details
about an exception that occurred.

JSP Explicit Object:


In JavaServer Pages (JSP), explicit objects refer to Java class instances that are explicitly
declared and created within the code of your JSP page.

Source Code:
<%@ page language="java" contentType="text/html" pageEncoding="UTF-8"
isErrorPage="true" %>
<html>
<head><title>JSP Implicit & Explicit Objects</title></head>

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

<body>
<%
// 1. request - get parameter
String name = [Link]("name");
if (name == null) name = "Guest";

// 2. response - set content type (optional, usually set by page directive)


[Link]("text/html");

// 3. out - print
[Link]("<h3>Hello, " + name + "</h3>");

// 4. session - save attribute


[Link]("username", name);

// 5. application - set app-wide attribute


[Link]("appTitle", "Simple JSP Demo");

// 6. config - get servlet name


[Link]("<p>Servlet Name: " + [Link]() + "</p>");

// 7. pageContext - get attribute from application scope


[Link]("<p>Application Title: " + [Link]("appTitle",
PageContext.APPLICATION_SCOPE) + "</p>");

// 8. page - current servlet instance class

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

[Link]("<p>Page Object: " + [Link]().getName() + "</p>");

// 9. exception - only for error pages


if (exception != null) {
[Link]("<p>Exception: " + [Link]() + "</p>");
} else {
[Link]("<p>No exception on this page.</p>");
}

// Explicit object: create current date


[Link] date = new [Link]();
[Link]("<p>Current Date and Time: " + [Link]() + "</p>");
%>

<form method="get" action="[Link]">


Enter your name: <input type="text" name="name" />
<input type="submit" value="Submit" />
</form>

</body>
</html>

Output:
Hello, Alice
Servlet Name: [Link]
Application Title: Simple JSP Demo
Page Object: [Link].example_jsp
No exception on this page.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Current Date and Time: Wed Sep 24 14:37:22 UTC 2025


Conclusion:
This Java program successfully demonstrates jsp implicit and explicit objects.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No 9

Aim: Implementation of Java Database Connectivity

Resources Required: NetBeans IDE 8.0.1

Theory:

A database is a collection of information that is organized so that it can be easily accessed,


managed and updated.
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.

Steps for Creating Database in NetBeans IDE 8.0.1


1) Click on Service tab
2) Expand Database option
3) Right Click on Java DB and then click on CreateDatabase
4) Specify Database Name, User name and password and click on OKbutton
Practical No.2
5) Right Click on jdbc:derby//localhost:1527/Library and click on connect option 6) Expand
your Database.
6) Click on Project tab and create new Java application.
7) Write following code in java class.
8) Attach Java DB driver in library
9) Run the program

Source Code:

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

package javaapplication1;

import [Link];

import [Link];

import [Link];

public class JavaApplication1 {

public static void main(String[] args) throws SQLException {

Connection
con=[Link]("jdbc:derby://localhost:1527/college","meet","meet");

[Link]("Connection created");

[Link] stmt=[Link]();

[Link]("Statement created");

[Link]("create table library(sname varchar(10),rollno int,gender


varchar(10),class varchar(10),bookname varchar(10),authorname varchar(10),issuedate
varchar(10),returndate varchar(10))");

[Link]("table created");

[Link]("insert into library values('meet',1,'male','sy','java','gauri','2 feb','9


feb')");

[Link]("Record inserted");

Output:

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

run:

Connection created

Statement created

table created

Record inserted

BUILD SUCCESSFUL (total time: 1 second)

Conclusion:
This Java program successfully demonstrates JDBC Concept.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

Experiment No 10

Aim: Design a web page using react

Resources Required: nextleap online editor for react

Theory:

React is an open-source JavaScript library developed by Facebook (Meta) for building user
interfaces (UIs), particularly for single-page applications (SPAs) where performance and
dynamic updates are important.

It is component-based, meaning the UI is divided into small, reusable parts (components),


making development easier and modular.

Advantages of React
 High performance due to Virtual DOM.
 Reusable components → faster development.
 Strong community and ecosystem.
 Easy integration with other libraries/frameworks.
 Supports React Native for mobile app development.
Limitations of React
 Requires learning JSX (not pure JavaScript).
 React focuses only on the view layer → additional libraries are needed for routing (React
Router) or state management (Redux, Context API).
 Frequent updates may confuse beginners.

Applications of React
 Single Page Applications (SPA).
 Dashboards and interactive websites.
 Social media platforms (e.g., Facebook, Instagram).
 E-commerce websites
 Cross-platform mobile apps (React Native).

Source Code:

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

import React from "react";


function App() {
return (
<div style={{ fontFamily: "Arial, sans-serif" }}>
{/* Header */}
<header style={{ background: "#4CAF50", padding: "20px", color: "white" }}>
<h1>My Simple React Page</h1>
<nav>
<a href="#home" style={{ margin: "0 15px", color: "white", textDecoration:
"none" }}>Home</a>
<a href="#about" style={{ margin: "0 15px", color: "white", textDecoration:
"none" }}>About</a>
<a href="#contact" style={{ margin: "0 15px", color: "white", textDecoration:
"none" }}>Contact</a>
</nav>
</header>
{/* Main Content */}
<main style={{ padding: "20px", textAlign: "center" }}>
<section id="home">
<h2>Welcome!</h2>
<p>This is a simple webpage built with React.</p>
</section>

<section id="about" style={{ marginTop: "40px" }}>


<h2>About</h2>
<p>React makes it easy to build interactive UIs with reusable components.</p>
</section>

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

<section id="contact" style={{ marginTop: "40px" }}>


<h2>Contact</h2>
<p>Email: example@[Link]</p>
</section>
</main>
{/* Footer */}
<footer style={{ background: "#333", color: "white", padding: "10px", marginTop: "20px",
textAlign: "center" }}>
<p>© 2025 My React Page</p>
</footer>
</div>
);
}
export default App;
Output:

Conclusion: The design of the web page using React has been successfully demonstrated.

SɅRɅSWɅTI
College of
Department of Computer SɅRɅSWɅTI Engineering
Engineering (DS)

SɅRɅSWɅTI

You might also like