0% found this document useful (0 votes)
21 views32 pages

web tech

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

web tech

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Dronacharya Group Of Institution

Practical Of Web Technology

Submitted By:- Submite To:-


Write a html code to create your curriculum vitae.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Name - Curriculum Vitae</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}

header {
background-color: #333;
color: #fff;
text-align: center;
padding: 1em 0;
}
section {
max-width: 800px;
margin: 20px auto;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h2 {
color: #333;
}

ul {
list-style-type: none;
padding: 0;
}

li {
margin-bottom: 5px;
}
.education, .experience {
margin-bottom: 20px;
}
</style>
</head>
<body>

<header>
<h1>Kaushal Pratap Singh</h1>
<p>Curriculum Vitae</p>
</header>

<section>
<h2>Contact Information</h2>
<p>Email: [email protected]</p>
<p>Phone: (123) 456-7890</p>
<p>LinkedIn: linkedin.com/in/Rounak</p>
<p>GitHub: github.com/JawanLaunada</p>
</section>
<section class="education">
<h2>Education</h2>
<ul>
<li><strong>Degree in Something</strong> - DGI, Graduation Year:-2025</li>
<li><strong>High School Diploma</strong> - DAV, Graduation
Year:-2019</li>
</ul>
</section>

<section class="experience">
<h2>Work Experience</h2>
<ul>
<li>
<strong>Full Stack Developer</strong> - Google, DGI ke Pichhe
<ul>
<li>I very hard wark person ,I have 2year experience that area</li>
<li>Front end and Back end work and also Know about database</li>
</ul>
</li>
</ul>
</section>

</body>
</html>
OUTPUT:-
Create student registration form for an Institute using HTML.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Registration Form</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
}

form {
max-width: 400px;
margin: 20px auto;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
button:hover {
background-color: #45a049;
}
input, select {
width: 100%;
padding: 8px;
margin-bottom: 16px;
box-sizing: border-box;
}

label {
display: block;
margin-bottom: 8px;
}

button {
background-color: #4caf50;
color: #fff;
padding: 10px 15px;
border: none;
cursor: pointer;
font-size: 16px;
}
</style>
</head>
<body>
<form>
<h2>Student Registration Form</h2>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="phone">Phone:</label>
<input type="tel" id="phone" name="phone" required>

<label for="course">Select Course:</label>


<select id="course" name="course" required>
<option value="" disabled selected>Select a course</option>
<option value="computer-science">Computer Science</option>
<option value="engineering">Engineering</option>
<!-- Add more options as needed -->
</select>
<button type="submit">Submit</button>
</form>
</body>
</html>
OUTPUT:-
. Write a program in java to sort the given String array alphabetically.

import java.util.Arrays;

public class StringArraySorting {


public static void main(String[] args) {
// Given String array
String[] name = {"Madras", "Delhi", "Ahmedabad", "Kolkata", "Bombay"};

// Sorting the array alphabetically


Arrays.sort(name);

// Displaying the sorted array


System.out.println("Sorted String Array:");
for (String city : name) {
System.out.println(city);
}
}
}
OUTPUT:-

java -cp /tmp/PJynoqubH6 StringArraySorting


Sorted String Array:Ahmedabad
Bombay
Delhi
Kolkata
Madras
Write a Program in java to create a package Mops that consists of mathematical operations
like addition, subtraction, division, modulus and multiplication as methods of class MathOps
and use it in another java file.

package Mops;

public class MathOps {


public static int add(int a, int b) {
return a + b;
}

public static int subtract(int a, int b) {


return a - b;
}

public static int multiply(int a, int b) {


return a * b;
}
public static double divide(int a, int b) {
if (b != 0) {
return (double) a / b;
} else {
System.out.println("Cannot divide by zero.");
return Double.NaN; // NaN (Not a Number) for an undefined result
}
}
public static int modulus(int a, int b) {
if (b != 0) {
return a % b;
} else {
System.out.println("Cannot calculate modulus with zero.");
return -1; // Return a placeholder value for an undefined result
}
}
}
import Mops.MathOps;

public class MainProgram {


public static void main(String[] args) {
int num1 = 10;
int num2 = 5;

// Using methods from the MathOps class in the Mops package


System.out.println("Addition: " + MathOps.add(num1, num2));
System.out.println("Subtraction: " + MathOps.subtract(num1, num2));
System.out.println("Multiplication: " + MathOps.multiply(num1, num2));
System.out.println("Division: " + MathOps.divide(num1, num2));
System.out.println("Modulus: " + MathOps.modulus(num1, num2));}}
OUTPUT:-

Addition: 15
Subtraction: 5
Multiplication: 50
Division: 2.0
Modulus: 0
Write a program using JavaScript to display browser information.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Browser Information</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 20px;
}
</style>
</head>
<body>
<h1>Browser Information</h1>
<script>
document.write("<p><strong>Browser Name:</strong> " + navigator.appName + "</p>");
document.write("<p><strong>Browser Version:</strong> " + navigator.appVersion + "</p>");
document.write("<p><strong>User Agent:</strong> " + navigator.userAgent + "</p>");
document.write("<p><strong>Platform:</strong> " + navigator.platform + "</p>");
document.write("<p><strong>Language:</strong> " + navigator.language + "</p>");
document.write("<p><strong>Cookies Enabled:</strong> " + navigator.cookieEnabled + "</p>");
document.write("<p><strong>Online Status:</strong> " + navigator.onLine + "</p>");
</script>

</body>
</html>

OUTPUT:-
Create a calculator using HTML, CSS and JavaScript.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}

#calculator {
border: 1px solid #ccc;
border-radius: 5px;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
input {
width: 100%;
padding: 10px;
margin-bottom: 10px;
box-sizing: border-box;
}

button {
width: 48px;
height: 48px;
margin: 5px;
font-size: 16px;
cursor: pointer;
}
</style>
</head>
<body>

<div id="calculator">
<input type="text" id="display" disabled>

<div>
<button
onclick="appendToDisplay('1')">1</button>
<button onclick="appendToDisplay('2')">2</button>
<button onclick="appendToDisplay('3')">3</button>
<button onclick="appendToDisplay('+')">+</button>
</div>

<div>
<button onclick="appendToDisplay('4')">4</button>
<button onclick="appendToDisplay('5')">5</button>
<button onclick="appendToDisplay('6')">6</button>
<button onclick="appendToDisplay('-')">-</button>
</div>

<div>
<button onclick="appendToDisplay('7')">7</button>
<button onclick="appendToDisplay('8')">8</button>
<button onclick="appendToDisplay('9')">9</button>
<button onclick="appendToDisplay('*')">*</button>
</div>

<div>
<button onclick="appendToDisplay('0')">0</button>
<button onclick="clearDisplay()">C</button>
<button onclick="calculateResult()">=</button>
<button onclick="appendToDisplay('/')">/</button>
</div>
</div>
<script>
function appendToDisplay(value) {
document.getElementById('display').value += value;
}

function clearDisplay() {
document.getElementById('display').value = '';
}

function calculateResult() {
var displayValue = document.getElementById('display').value;
var result = eval(displayValue);

document.getElementById('display').value = result;
}
</script>

</body>
</html>
OUTPUT:-
Write JavaScript to validate the following fields of the Registration page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registration Form</title>
<style>
body {
font-family: Arial, sans-serif;
}

.error {
color: red;
}
</style>
</head>
<body>

<h1>Registration Form</h1>

<form id="registrationForm" onsubmit="return validateForm()">


<label for="firstName">First Name:</label>
<input type="text" id="firstName" name="firstName" required>
<span id="firstNameError" class="error"></span>

<br>

<label for="lastName">Last Name:</label>


<input type="text" id="lastName" name="lastName" required>
<span id="lastNameError" class="error"></span>

<br>

<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<span id="passwordError" class="error"></span>

<br>

<label for="email">E-mail:</label>
<input type="email" id="email" name="email" required>
<span id="emailError" class="error"></span>

<br>
<label for="mobileNumber">Mobile Number:</label>
<input type="tel" id="mobileNumber" name="mobileNumber" required>
<span id="mobileNumberError" class="error"></span>

<br>

<label for="address">Address:</label>
<textarea id="address" name="address" required></textarea>
<span id="addressError" class="error"></span>

<br>

<button type="submit">Submit</button>
</form>

<script>
function validateForm() {
const validate = (field, regex, errorMessage) => {
const value = document.getElementById(field).value.trim();
const errorElement = document.getElementById(`${field}Error`);
errorElement.innerText = !regex.test(value) ? errorMessage : '';
return regex.test(value);
};
return validate('firstName', /^[A-Za-z]+$/, 'First Name should contain alphabets and must not be empty') &&
validate('lastName', /^[A-Za-z]+$/, 'Last Name should contain alphabets and must not be empty') &&
validate('password', /^.{6,}$/, 'Password must be at least 6 characters long') &&
validate('email', /^[^\s@]+@[^\s@]+\.[^\s@]+$/, 'Invalid email format. Example: [email protected]') &&
validate('mobileNumber', /^\d{10}$/, 'Mobile number should contain 10 digits only') &&
validate('address', /.+/, 'Address must not be empty');
}
</script>

</body>
</html>

OUTPUT:-
Write a java program/servlet/JSP to connect database and create a table customer_info and insert the following records in it.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class DatabaseExample {

public static void main(String[] args) {


// JDBC URL, username, and password of MySQL server
String url = "jdbc:mysql://localhost:3306/your_database_name";
String user = "your_username";
String password = "your_password";

// SQL statement to create the table


String createTableSQL = "CREATE TABLE IF NOT EXISTS customer_info (" +
"CustomID VARCHAR(10), " +
"Customer_Name VARCHAR(50), " +
"Last_Name VARCHAR(50), " +
"Age INT, " +
"Country VARCHAR(50)" +
")";
// SQL statements to insert records
String insertRecordSQL = "INSERT INTO customer_info (CustomID, Customer_Name, Last_Name, Age, Country) VALU

try (
// Establishing the connection
Connection connection = DriverManager.getConnection(url, user, password);

// Creating the table


PreparedStatement createTableStatement = connection.prepareStatement(createTableSQL);
// Inserting records
PreparedStatement insertRecordStatement = connection.prepareStatement(insertRecordSQL);
){
// Creating the table
createTableStatement.execute();

// Inserting records
insertRecordStatement.setString(1, "C101");
insertRecordStatement.setString(2, "Shankaran");
insertRecordStatement.setString(3, "Pillai");
insertRecordStatement.setInt(4, 29);
insertRecordStatement.setString(5, "India");
insertRecordStatement.executeUpdate();
insertRecordStatement.setString(1, "C102");
insertRecordStatement.setString(2, "John");
insertRecordStatement.setString(3, "Doe");
insertRecordStatement.setInt(4, 25);
insertRecordStatement.setString(5, "US");
insertRecordStatement.executeUpdate();

insertRecordStatement.setString(1, "C103");
insertRecordStatement.setString(2, "David");
insertRecordStatement.setString(3, "Robinson");
insertRecordStatement.setInt(4, 28);
insertRecordStatement.setString(5, "UK");
insertRecordStatement.executeUpdate();

System.out.println("Records inserted successfully!");

} catch (SQLException e) {
e.printStackTrace();
}
}
}
OUTPUT:-
Write a java program/servlet/JSP to connect database and extract data from the table customer_info and display them.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class RetrieveDataExample {

public static void main(String[] args) {


// JDBC URL, username, and password of MySQL server
String url = "jdbc:mysql://localhost:3306/your_database_name";
String user = "your_username";
String password = "your_password";

// SQL statement to retrieve data from the table


String selectDataSQL = "SELECT CustomID, Customer_Name, Last_Name, Age, Country FROM customer_info";

try (
// Establishing the connection
Connection connection = DriverManager.getConnection(url, user, password);
// Preparing the SQL statement
PreparedStatement selectDataStatement = connection.prepareStatement(selectDataSQL);

// Executing the query and retrieving the result set


ResultSet resultSet = selectDataStatement.executeQuery();
){
// Displaying the retrieved data
System.out.println("CustomID\tCustomer_Name\tLast_Name\tAge\tCountry");
while (resultSet.next()) {
String customID = resultSet.getString("CustomID");
String customerName = resultSet.getString("Customer_Name");
String lastName = resultSet.getString("Last_Name");
int age = resultSet.getInt("Age");
String country = resultSet.getString("Country");

System.out.println(customID + "\t" + customerName + "\t" + lastName + "\t" + age + "\t" + country);


}

} catch (SQLException e) {
e.printStackTrace();
}
}
}

You might also like