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: [Link]/in/Rounak</p>
<p>GitHub: [Link]/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 [Link];
public class StringArraySorting {
public static void main(String[] args) {
// Given String array
String[] name = {"Madras", "Delhi", "Ahmedabad", "Kolkata", "Bombay"};
// Sorting the array alphabetically
[Link](name);
// Displaying the sorted array
[Link]("Sorted String Array:");
for (String city : name) {
[Link](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 {
[Link]("Cannot divide by zero.");
return [Link]; // NaN (Not a Number) for an undefined result
}
}
public static int modulus(int a, int b) {
if (b != 0) {
return a % b;
} else {
[Link]("Cannot calculate modulus with zero.");
return -1; // Return a placeholder value for an undefined result
}
}
}
import [Link];
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
[Link]("Addition: " + [Link](num1, num2));
[Link]("Subtraction: " + [Link](num1, num2));
[Link]("Multiplication: " + [Link](num1, num2));
[Link]("Division: " + [Link](num1, num2));
[Link]("Modulus: " + [Link](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>
[Link]("<p><strong>Browser Name:</strong> " + [Link] + "</p>");
[Link]("<p><strong>Browser Version:</strong> " + [Link] + "</p>");
[Link]("<p><strong>User Agent:</strong> " + [Link] + "</p>");
[Link]("<p><strong>Platform:</strong> " + [Link] + "</p>");
[Link]("<p><strong>Language:</strong> " + [Link] + "</p>");
[Link]("<p><strong>Cookies Enabled:</strong> " + [Link] + "</p>");
[Link]("<p><strong>Online Status:</strong> " + [Link] + "</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) {
[Link]('display').value += value;
}
function clearDisplay() {
[Link]('display').value = '';
}
function calculateResult() {
var displayValue = [Link]('display').value;
var result = eval(displayValue);
[Link]('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 = [Link](field).[Link]();
const errorElement = [Link](`${field}Error`);
[Link] =  ? errorMessage : '';
return [Link](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: name@[Link]') &&
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 [Link];
import [Link];
import [Link];
import [Link];
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 = [Link](url, user, password);
// Creating the table
PreparedStatement createTableStatement = [Link](createTableSQL);
// Inserting records
PreparedStatement insertRecordStatement = [Link](insertRecordSQL);
){
// Creating the table
[Link]();
// Inserting records
[Link](1, "C101");
[Link](2, "Shankaran");
[Link](3, "Pillai");
[Link](4, 29);
[Link](5, "India");
[Link]();
[Link](1, "C102");
[Link](2, "John");
[Link](3, "Doe");
[Link](4, 25);
[Link](5, "US");
[Link]();
[Link](1, "C103");
[Link](2, "David");
[Link](3, "Robinson");
[Link](4, 28);
[Link](5, "UK");
[Link]();
[Link]("Records inserted successfully!");
} catch (SQLException e) {
[Link]();
}
}
}
OUTPUT:-
Write a java program/servlet/JSP to connect database and extract data from the table customer_info and display them.
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
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 = [Link](url, user, password);
// Preparing the SQL statement
PreparedStatement selectDataStatement = [Link](selectDataSQL);
// Executing the query and retrieving the result set
ResultSet resultSet = [Link]();
){
// Displaying the retrieved data
[Link]("CustomID\tCustomer_Name\tLast_Name\tAge\tCountry");
while ([Link]()) {
String customID = [Link]("CustomID");
String customerName = [Link]("Customer_Name");
String lastName = [Link]("Last_Name");
int age = [Link]("Age");
String country = [Link]("Country");
[Link](customID + "\t" + customerName + "\t" + lastName + "\t" + age + "\t" + country);
}
} catch (SQLException e) {
[Link]();
}
}
}