Wa0007.
Wa0007.
Wa0007.
HTML File
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS Demonstration</title>
<style>
body {
.internal-style {
</style>
</head>
<body>
</body>
</html>
.external-style {
color: red; /* CSS for class defined in an external stylesheet */ font-size: 16px;
.imported-style {
color: purple; /* CSS for class defined in an imported stylesheet */ font-weight: bold;
}
Program no.=14
Write programs using Java script for Web Page to display browsers information.
<!DOCTYPE html>
<html>
<head>
<title>Browser Information</title>
</head>
<body>
<h1>Browser Information</h1>
<p id="browserInfo"></p>
<script>
function displayBrowserInfo() {
<br>";
document.getElementById("browserInfo").innerHTML = browserInfo;
}
// Call the function to display browser information
displayBrowserInfo();
</script>
</body>
</html>
Program no. =15
Id and Password.
“united.ac.in”
<!DOCTYPE html>
<html>
<head>
<title>Form Validation</title>
<script>
function validateForm() {
return false;
if (!mobileNumber.match(mobilePattern)) {
return false;
if (!email.match(emailPattern)) {
return false;
if (!password.match(passwordPattern)) {
alert("Password must have at least one alphabet, one digit, and one special
character (!@#$%&*), and be at least 8 characters long.");
return false;
return true;
</script>
</head>
<body>
<h1>Form Validation</h1>
</form>
</body>
</html>
Program no. =16
16 Writing program in XML for creation of DTD which specifies set of rules. Create a style
sheet in CSS/ XSL & display the document in internet explore.
<?xml version="1.0"?>
<data>
<name>John Doe</name>
<age>30</age>
</data>
example.dtd:
Style Sheet in CSS/XSL: Create a CSS file (style.css) to style the XML document:
style.css:
data {
color: blue;
name {
font-weight: bold;
age {
color: green;
}
Program no. = 17
Write a program to implement Math server using TCP socket and also write a client program
to send user input to Math server and display response as the square of the given number.
MathServer.java:
import java.io.*;
import java.net.*;
try {
while (true) {
clientSocket.close();
} catch (IOException e) {
e.printStackTrace();
MathClient.java:
import java.io.*;
import java.net.*;
try {
out.println(number);
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
Program no.=18
Write a program to illustrate CURD operations using JDBC connectivity with MySQL
database.
name VARCHAR(50),
age INT
);
CRUDOperations.java:
import java.sql.*;
try {
Class.forName(JDBC_DRIVER);
conn = DriverManager.getConnection(DB_URL, USER, PASS);
stmt = conn.createStatement();
// Create operation
String createQuery = "INSERT INTO students (name, age) VALUES ('Alice', 25)";
stmt.executeUpdate(createQuery);
// Read operation
ResultSet rs = stmt.executeQuery(readQuery);
while (rs.next()) {
// Update operation
stmt.executeUpdate(updateQuery);
// Delete operation
stmt.executeUpdate(deleteQuery);
rs.close();
stmt.close();
conn.close();
} catch (SQLException se) {
se.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
try {
se.printStackTrace();
}
Program no. = 19
Write a SQL query to create and call the stored procedures with following specifications:
DELIMITER //
BEGIN
END //
DELIMITER ;
DELIMITER //
BEGIN
END //
DELIMITER ;
DELIMITER //
BEGIN
SET result_square = input_number * input_number;
END //
DELIMITER ;
CALL sp_no_param_no_return();
CALL sp_with_param_no_return(@name);
SET @number = 5;
Write a program to illustrate CURD operations using JSP connectivity with MySQL database
on Apache Tomcat web server.
name VARCHAR(50),
age INT
);
<%
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost/your_database_name",
"your_username", "your_password");
pstmt.setString(1, name);
pstmt.setInt(2, age);
pstmt.executeUpdate();
out.println("Student created successfully!");
pstmt.close();
conn.close();
%>
<%
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost/your_database_name",
"your_username", "your_password");
while (rs.next()) {
out.println("ID: " + rs.getInt("id") + ", Name: " + rs.getString("name") + ", Age: " +
rs.getInt("age") + "<br>");
rs.close();
stmt.close();
conn.close();
%>
<%
int id = Integer.parseInt(request.getParameter("id"));
int newAge = Integer.parseInt(request.getParameter("newAge"));
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost/your_database_name",
"your_username", "your_password");
pstmt.setInt(1, newAge);
pstmt.setInt(2, id);
pstmt.executeUpdate();
pstmt.close();
conn.close();
%>
<%
int id = Integer.parseInt(request.getParameter("id"));
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost/your_database_name",
"your_username", "your_password");
pstmt.setInt(1, id);
pstmt.executeUpdate();
out.println("Student deleted successfully!");
pstmt.close();
conn.close();
%>