Professional Documents
Culture Documents
WT Ankush FInal
WT Ankush FInal
Content stored
securely
Code:
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, ini al-scale=1.0">
< tle>Harry Po er Book Store</ tle>
<link rel="stylesheet" href="styles.css">
<link rel="preconnect" href="h ps://fonts.gsta c.com">
</head>
<body>
<header>
<nav class="navbar">
<div class="container">
<div class="navbar-brand">
<h1>Harry Po er Book Store</h1>
</div>
<div class="navbar-menu">
<ul>
<li><a href="./index.html">Home</a></li>
<li class="dropdown">
<a href="#">Menu</a>
<div class="dropdown-content">
<a href="index.html">Books</a>
<a href="contact.html">Contact</a>
<a href="about.html">About Us</a>
<a href="terms.html">Terms</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
</header>
<hr />
<div class="container">
<div class="book">
<a href="h ps://www.amazon.com/Harry-Po er-Sorcerers-Stone-Rowling-
ebook/dp/B0192CTMYG?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMYG"
target="_blank">
<h2><a href="h ps://www.amazon.com/Harry-Po er-Sorcerers-Stone-Rowling-
ebook/dp/B0192CTMYG?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMYG"
target="_blank">Harry Po er and the Sorcerer's Stone</a></h2>
<img src="images/book1.jpg" alt="Harry Po er and the Sorcerer's Stone">
</a>
</div>
<div class="book">
<a href="h ps://www.amazon.com/Harry-Po er-Chamber-Secrets-Rowling-
ebook/dp/B0192CTMW8?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMW8"
target="_blank">
<h2><a href="h ps://www.amazon.com/Harry-Po er-Chamber-Secrets-Rowling-
ebook/dp/B0192CTMW8?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMW8"
target="_blank">Harry Po er and the Chamber of Secrets</a></h2>
<img src="images/book2.jpg" alt="Harry Po er and the Chamber of Secrets">
</a>
</div>
<div class="book">
<a href="h ps://www.amazon.com/Harry-Po er-Prisoner-Azkaban-Rowling-
ebook/dp/B0192CTMX2?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMX2"
target="_blank">
<h2><a href="h ps://www.amazon.com/Harry-Po er-Prisoner-Azkaban-Rowling-
ebook/dp/B0192CTMX2?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMX2"
target="_blank">Harry Po er and the Prisoner of Azkaban</a></h2>
<img src="images/book3.jpg" alt="Harry Po er and the Prisoner of Azkaban">
</a>
</div>
<div class="book">
<a href="h ps://www.amazon.com/Harry-Po er-Goblet-Fire-Rowling-
ebook/dp/B0192CTMUU?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMUU"
target="_blank">
<h2><a href="h ps://www.amazon.com/Harry-Po er-Goblet-Fire-Rowling-
ebook/dp/B0192CTMUU?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMUU"
target="_blank">Harry Po er and the Goblet of Fire</a></h2>
<img src="images/book4.jpg" alt="Harry Po er and the Goblet of Fire">
</a>
</div>
<div class="book">
<a href="h ps://www.amazon.com/Harry-Po er-Order-Phoenix-Rowling-
ebook/dp/B0192CTMXM?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMXM"
target="_blank">
<h2><a href="h ps://www.amazon.com/Harry-Po er-Order-Phoenix-Rowling-
ebook/dp/B0192CTMXM?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMXM"
target="_blank">Harry Po er and the Order of the Phoenix</a></h2>
<img src="images/book5.jpg" alt="Harry Po er and the Order of the Phoenix">
</a>
</div>
<div class="book">
<a href="h ps://www.amazon.com/Harry-Po er-Half-Blood-Prince-Rowling-
ebook/dp/B0192CTMWI?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMWI"
target="_blank">
<h2><a href="h ps://www.amazon.com/Harry-Po er-Half-Blood-Prince-Rowling-
ebook/dp/B0192CTMWI?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMWI"
target="_blank">Harry Po er and the Half-Blood Prince</a></h2>
<img src="images/book6.jpg" alt="Harry Po er and the Half-Blood Prince">
</a>
</div>
<div class="book">
<a href="h ps://www.amazon.com/Harry-Po er-Deathly-Hallows-Rowling-
ebook/dp/B0192CTMWS?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMWS"
target="_blank">
<h2><a href="h ps://www.amazon.com/Harry-Po er-Deathly-Hallows-Rowling-
ebook/dp/B0192CTMWS?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B0192CTMWS"
target="_blank">Harry Po er and the Deathly Hallows</a></h2>
<img src="images/book7.jpg" alt="Harry Po er and the Deathly Hallows">
</a>
</div>
<div class="book">
<a href="h ps://www.amazon.com/Harry-Po er-Cursed-Child-Playscript-
ebook/dp/B073P962D9?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B073P962D9"
target="_blank">
<h2><a href="h ps://www.amazon.com/Harry-Po er-Cursed-Child-Playscript-
ebook/dp/B073P962D9?Subscrip onId=AKIAJJIX76K7CKA7Q6TA&tag=reedwebs-
20&linkCode=xm2&camp=2025&crea ve=165953&crea veASIN=B073P962D9"
target="_blank">Harry Po er and the Cursed Child</a></h2>
<img src="images/book8.jpg" alt="Harry Po er and the Deathly Hallows">
</a>
</div>
</div>
<footer>
<p>© 2024 · Ankush Tiwari. All rights reserved.</p>
<p>
<a href="contact.html">Contact Us</a>
<a href="about.html">About Us</a>
<a href="terms.html">Terms and Condi ons</a>
</p>
</footer>
</body>
</html>
Styles.css
/* Rese ng default margin and padding for all elements */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
display: flex;
jus fy-content: space-between;
align-items: center;
}
.navbar-brand h1 {
color: #372f2f;
margin: 12px;
}
.navbar-menu ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.navbar-menu ul li {
display: inline-block;
}
.navbar-menu ul li a {
color: #110f0f;
text-decora on: none;
padding: 10px 20px;
display: block;
}
.dropdown-content a {
color: #fff;
padding: 12px 12px;
text-decora on: none;
display: block;
}
.dropdown-content a:hover {
background-color: #555;
}
/* Responsive styles */
@media screen and (max-width: 768px) {
.container {
flex-direc on: column;
}
.navbar-menu {
margin-top: 10px;
}
.navbar-menu ul li {
display: block;
text-align: center;
}
.navbar-menu ul li.dropdown {
posi on: rela ve;
}
.dropdown-content {
posi on: sta c;
display: none;
background-color: transparent;
width: 100%;
}
.dropdown-content a {
border-bo om: 1px solid #fff;
}
}
Implemented Screenshots:
Code
Employee.dtd
<!ELEMENT company (employee+)>
<!ELEMENT employee
(username,password,firstName,lastName,gender,email,posi on,salary,contact)
>
<!ELEMENT username (#PCDATA)>
<!ELEMENT password (#PCDATA)>
<!ELEMENT firstName (#PCDATA)>
<!ELEMENT lastName (#PCDATA)>
<!ELEMENT gender (#PCDATA)>
<!ELEMENT email (#PCDATA)>
<!ELEMENT posi on (#PCDATA)>
<!ELEMENT salary (#PCDATA)>
<!ELEMENT contact (#PCDATA)>
Employee.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="employee.xsl"?>
<!DOCTYPE company SYSTEM "employee.dtd">
<company>
<employee>
<username>Alex123</username>
<password>alex123</password>
<firstName>Alex</firstName>
<lastName>Smith</lastName>
<gender>Male</gender>
<email>alexsmith@gmail.com</email>
<posi on>So ware Developer</posi on>
<salary>9.5lpa</salary>
<contact>+91 7051794388</contact>
</employee>
<employee>
<username>Mary789</username>
<password>mary789</password>
<firstName>Mary</firstName>
<lastName>Jones</lastName>
<gender>Female</gender>
<email>maryjones@gmail.com</email>
<posi on>Project Manager</posi on>
<salary>11lpa</salary>
<contact>+91 9876543210</contact>
</employee>
<employee>
<username>JohnDoe</username>
<password>johndoe123</password>
<firstName>John</firstName>
<lastName>Doe</lastName>
<gender>Male</gender>
<email>johndoe@example.com</email>
<posi on>Marke ng Manager</posi on>
<salary>12lpa</salary>
<contact>+91 9934671209</contact>
</employee>
</company>
Employee.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="h p://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
< tle>Employee Informa on</ tle>
</head>
<body>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th {
font-size: 18px;
color: blue;
border: 1px solid black;
padding: 8px;
text-align: le ;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
th:hover{
background-color: black;
color:white;
}
tr:hover {
background-color: black;
color:white;
}
td {
border: 1px solid black;
padding: 8px;
ver cal-align: top;
}
td.salary {
text-align: right;
}
</style>
<table>
<tr>
<th>Username</th>
<th>Password</th>
<th>First Name</th>
<th>Last Name</th>
<th>Gender</th>
<th>Email</th>
<th>Posi on</th>
<th>Salary</th>
<th>Contact</th>
</tr>
<xsl:for-each select="company/employee">
<tr>
<td>
<xsl:value-of select="username" />
</td>
<td>
<xsl:value-of select="password" />
</td>
<td>
<xsl:value-of select="firstName" />
</td>
<td>
<xsl:value-of select="lastName" />
</td>
<td>
<xsl:value-of select="gender" />
</td>
<td>
<xsl:value-of select="email" />
</td>
<td>
<xsl:value-of select="posi on" />
</td>
<td class="salary">
₹<xsl:value-of select="salary"/>
</td>
<td>
<xsl:value-of select="contact" />
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Implemented Screenshots:
Code:
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, ini al-scale=1.0">
< tle>Form Valida on</ tle>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
max-width: 400px;
margin: 50px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
.form-group {
margin-bo om: 15px;
}
label {
display: block;
font-weight: bold;
}
input[type="text"] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0056b3;
}
.error {
color: red;
}
</style>
</head>
<body>
<div class="container">
<h2>Form Valida on</h2>
<form id="myForm" onsubmit="return validateForm()">
<div class="form-group">
<label for="fullname">Full Name:</label>
<input type="text" id="fullname" name="fullname">
</div>
<div class="form-group">
<label for="class">Class:</label>
<input type="text" id="class" name="class">
</div>
<div class="form-group">
<label for="department">Department:</label>
<input type="text" id="department" name="department">
</div>
<div class="form-group">
<label for="address">Address:</label>
<input type="text" id="address" name="address">
</div>
<div class="form-group">
<label for="phone">Phone Number:</label>
<input type="text" id="phone" name="phone">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="text" id="email" name="email">
</div>
<input type="submit" value="Submit">
</form>
</div>
<script>
func on validateForm() {
var fullname = document.getElementById('fullname').value;
var className = document.getElementById('class').value;
var department = document.getElementById('department').value;
var address = document.getElementById('address').value;
var phone = document.getElementById('phone').value;
var email = document.getElementById('email').value;
if (fullname === '' || className === '' || department === '' || address === '' || phone
=== '' || email === '') {
alert('All fields are mandatory.');
return false;
}
if (!/^\d+$/.test(phone)) {
alert('Phone number should contain numbers only.');
return false;
}
if (!/\S+@\S+\.\S+/.test(email)) {
alert('Email should be in proper format like abc@abc.com');
return false;
}
return true;
}
</script>
</body>
</html>
Implemented Screenshots
CODE: -
register.java
import java.io.IOExcep on;
import java.io.PrintWriter;
import java.sql.Connec on;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.servlet.ServletExcep on;
import javax.servlet.annota on.WebServlet;
import javax.servlet.h p.H pServlet;
import javax.servlet.h p.H pServletRequest;
import javax.servlet.h p.H pServletResponse;
/* * Servlet implementa on class Register*/
@WebServlet("/register")
public class register extends H pServlet {
private sta c final long serialVersionUID = 1L;
/* * @see H pServlet#H pServlet()*/
public register() {
super();
// TODO Auto-generated constructor stub
}
/** @see H pServlet#doGet(H pServletRequest request, H pServletResponse response)*/
protected void doGet(H pServletRequest request, H pServletResponse response) throws
ServletExcep on, IOExcep on {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/*** @see H pServlet#doPost(H pServletRequest request, H pServletResponse response)*/
protected void doPost(H pServletRequest request, H pServletResponse response) throws
ServletExcep on, IOExcep on {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
<div class="container-fluid">
<?php
// Taking all 5 values from the form data(input)
$name = $_REQUEST['name'];
$id = $_REQUEST['id'];
$roll = $_REQUEST['roll'];
$class = $_REQUEST['class'];
$address= $_REQUEST['address'];
// Performing insert query execution
$sql = "UPDATE studentdata SET id='$id',rollno='$roll',name='$name',class='$class',address='$address'
WHERE id='$id'";
if(mysqli_query($conn, $sql)){
echo "<div class='alert alert-success' role='alert'>
Update Successful Thank you !
<a href='index.php'> <button type='submit' class='btn btn-success'>Back To Home</button></a>
</div>";
}else{
echo "<div class='alert alert-danger' role='alert'>
Try Again Something went wrong ! May Already Register
<a href='Index.php'> <button type='submit' class='btn btn-success'>Back To Home</button></a>
</div> ";
}
// Close connection
mysqli_close($conn);
?>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-
DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF"
crossorigin="anonymous"></script>
</body>
</html>
File Name: - student.sql
create database student;
use student;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
ALTER TABLE `studentdata` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;
</div>
</div>
</div>
</div>
<!--update-->
<div class="modal fade" id="exampleModal2" tabindex="-1" aria-labelledby="exampleModalLabel" aria-
hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Update Student</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="update.php" method="post">
<div class="form-group">
<label for="recipient-name" class="col-form-label">ID:</label>
<input type="number" class="form-control" name="id">
</div>
<div class="form-group">
<label for="recipient-name" class="col-form-label">Roll Number:</label>
<input type="number" class="form-control" name="roll">
</div>
<div class="form-group">
<label for="recipient-name" class="col-form-label">Name:</label>
<input type="text" class="form-control" name="name">
</div>
<div class="form-group">
<label for="recipient-name" class="col-form-label">Class:</label>
<input type="text" class="form-control" name="class">
</div>
<div class="form-group">
<label for="recipient-name" class="col-form-label">Address:</label>
<input type="text" class="form-control" name="address">
</div>
<button type="submit" class="btn btn-primary" name="adminlogin">Add Student</button>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!--Delete-->
<div class="modal fade" id="exampleModal1" tabindex="-1" aria-labelledby="exampleModalLabel" aria-
hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Delete</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="delete.php" method="post">
<div class="form-group">
<label for="recipient-name" class="col-form-label">ID:</label>
<input type="number" class="form-control" name="id">
</div>
<action-mappings>
<action path="/login" type="com.example.struts.LoginAction" name="LoginForm"
validate="true" input="/login.jsp">
<forward name="success" path="/success.jsp"/>
</action>
</action-mappings>
<message-resources parameter="com.example.struts.ApplicationResources"/>
</struts-config>
package com.myapp.struts;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts.action.ActionMessage;
public class LoginAction extends ActionSupport {
public LoginAction() {
super();
}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
return errors;
}
}
<html>
<head>
< tle>Implement Bank Applica on using EJB</ tle>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, ini al-scale=1.0">
</head>
<body>
<form method="post" ac on="transact">
<h1>Bank Applica on using EJB </h1>
Enter Amount : <input type="text" name="t1" />
<h3>Select op on</h3>
<input type="radio" name="transac on"value="deposite" />Deposite<br/>
<input type="radio" name="transac on"value="withdraw" />withdraw<br/>
<input type="submite" value="submite" />
</form>
</body>
</html>
transact.java
import java.io.IOExcep on;
import java.io.PrintWriter;
import javax.servlet.ServletExcep on;
import javax.servlet.h p.H pServlet;
import javax.servlet.h p.H pServletRequest;
import javax.servlet.h p.H pServletResponse;
public class transact extends h pServlet {
protected void processRequest(H pServletRequest request, H pServletResponse response) throws ServletExcep on, IOExcep on
{
response.setContentType("text/html;charset=UTF-8");
try
{
PrintWriter out = response.getWriter()};
String selectdType=request.getParameter("transact");
int amount=Integer.ParseInt(request.getParameter(t1));
if(selectdType.equals("deposite"))
{
bankTransact.deposite(amount);
}
if(selectdType.equals("withdraw"))
{
int amt=bankTransact.withdraw(amount);
out.println(amount="successfully withdraw. Your Balance is: Rs"+ amt)
}
}
}
private BankTransactLocal lookupBankTransactLocal()
{
try
{
Context c= New ini alContext();
return(BankTransactLocal)c.Lookup("java.global/Bank/Bank-ejb/BankTransact!Bankexamp.Bank/Bank-
ejb/BankTransactLocal")
}
catch (NamingExcep on ne)
{
Logger.getLogger(getClass().getName().log(Level.SEVERE,"excep on caught",ne))
throw new Run meExcep on(ne);
}
}
BankTransact.java
package bankexamp;
inport javax.ejb.Sta ul;
@Stateful
public class BankTransact implements BankTransactLocal{
int balance=10000;
@override
public int deposit (int amount){
balance=balance+amount;
return balance;
}
@override
public int withdraw (int amount){
balance=balance-amount
return balance;
}
}
Output: