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

WT Manual With Code

Uploaded by

akx0094
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)
21 views74 pages

WT Manual With Code

Uploaded by

akx0094
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
You are on page 1/ 74

CODE:

Display.css
<html>
<head>
<title> display</title>
</head>
<body>
<h1 style="color:blue;margin-left:30px;"> You have submitted the form successfully </h1>
</body>
</html>
samp.css
.con
{
width:400px; height:400px;
background-color:white;
color:blue;
padding:0px 10px 0px 10px;
margin:auto;
}
.main
{
width:400px;
height:80px;
float:left;
padding:60px 10px 10px10px;
margin: auto;
}
.con1
{
width:200px;
height:30px;
float:left;
margin:auto;
padding:0px 0px 0px0px;
}
.con2
{
width:150px;
height:30px;
float:left;
margin:10px 10px 10px10px;
padding:0px 0px 0px0px;
}

#terms
{

color:blue;
padding-left:400px;
}
two.html

<html>
<head>
<title>regform</title>
<link href="samp.css"
rel="stylesheet"></link> </head>

<body>

<div class="con">
<form action="display.html" method="get" align="center">

<div class="con2">
<imgsrc="/home/sanyuja/Desktop/b.jpg" width=380px height=100px alt="img">
</div>
<div class="main">
<table align="center">
<tr>
<td><h1>Welcome to Registration
Page</h1></td></tr> </table>

<div class="con1">
<table align="center">
<tr>
<td>Full Name:</td>
<td><input type="text" value=""></input></td>
</tr>

<tr>
<td>Select Gender</td>
<td><input type="radio" name="gender"/>Female</input>
<input type="radio" name="gender"/>Male</input></td> </tr>
<br>
<tr>
<td>Class</td>
<td><input type="text" value=""></input></td>
</tr>
<br>
<tr>
<td>Skills</td>
<td><input type="checkbox" value="">C </input>
<input type="checkbox" value="">C++</input> <input
type="checkbox" value="">JAVA</input> <input
type="checkbox" value="">PHP</input> <input
type="checkbox" value="">AJAX</input></td>
</tr>
<br>
<tr>
<td>Department</td>
<td>
<select>
<option value="comp">COMPUTER</option> <option
value="it">Information Technology</option>
<option value="it">Electronics & Telecomunications</option>
<option value="mech">Mechnical</option>
<option value="civil">Civil</option>
</select>
</td>

</tr>

<tr>
<td>email:</td>
<td><input type="text" value=""></input></td>
</tr>
<tr>
<td>phone:</td>
<td><input type="text" value=""></input></td>
</tr>

<tr></tr><tr></tr>
</table>

<table align="center">
<tr>
<td><input type="submit" value="SUBMIT"></td>
<td><input type="reset" value="CANCEL"></td>

</td>
</tr>
</table>

</div>
</div>
</form>

</div>
<br><br><br><br>

<div id="terms">
<span>By clicking Submit you agree to our Terms &
Conditions</span> </div>
</body>

</html>

OUTPUT:
CODE:

<?xml version="1.0" encoding="UTF-8"?>


<?xml-stylesheet type="text/css" href="book.css"?>
<CATLOG>
<BOOK>
<TITLE> DATABASE MANAGEMENT SYSTEM</TITLE>
<AUTHOR>ABC</AUTHOR>
<YEAR>1992</YEAR>
<PRICE>3000</PRICE>
</BOOK>
<BOOK>
<TITLE> WEB TECHNOLOGY</TITLE>
<AUTHOR>XYZ</AUTHOR>
<YEAR>1993</YEAR>
<PRICE>4000</PRICE>
</BOOK>
<BOOK>
<TITLE> DATA ANALYSIS</TITLE>
<AUTHOR>PPP</AUTHOR>
<YEAR>1997</YEAR>
<PRICE>7800</PRICE>
</BOOK>
</CATLOG>

BOOK {
Display: block; margin-left:0;
magin-bottom: 30pt;}
CATALOG {
Width:100%;
background-color: #ffffff;
} TITLE {
Color: ff0000; display:
block; font-size: 20pt;}
AUTHOR {
display: block; color:
#0000ff; font-size: 20pt;}
YEAR, PRICE {
Color:#00000;
Display: block;
Margin-left: 20pt;}

OUTPUT:
CODE:

CSS

.one
{
width:400px; height:400px;
background-color:blue;

padding:0px,10px,0px,10px;
margin:auto;
border:solid; border-
color:black;

}
.main{}

JS

<html>
<head>
<title>Javascript</title>
</head>
<body>
<script language="JavaScript">

document.write("Student Registration Form"); document.write("<input


type="text" value=" "></input>");

</script>
</body>
</html>

HTML

<html>
<head>
<titel> </title>
<link href="ass4.css" rel="stylesheet"></link>
<script language="JavaScript">

function validateForm()
{
var x=document.forms["myForm"]
["fname"].value;
if(x=="")
{
alert("Enter the all details. ");
return false;
}

var x=document.forms["myForm"]
["mname"].value;
if(x=="")
{
alert("Enter the all details. ");
return false;
}

var x=document.forms["myForm"]
["lname"].value;
if(x=="")
{
alert("Enter the all details. ");
return false;
}

var y=document.forms["myForm"]
["add"].value;
if(y=="")
{
alert("Enter the all details. ");
return false;
}

var z=document.forms["myForm"] ["email"].value;


if(z=="")
{
alert("Enter the all details. ");
return false;
}

var a=document.forms["myForm"] ["ph"].value;


if(a=="")
{
alert("Enter the all details. ");
return false;
}

document.forms["myForm"].reset()
}
</script>
</head>
<body >
<center>
<div class="main">
<h1>Form Validation Using jQuery</h1>
<div id="form">
<p id="head"></p> <!-- This Segment Displays The Validation Rule -->

<form name="myForm" action="message.html" align="center"


onsubmit="return validateForm()" method="post" >

First Name: <input type="text" name="fname"><br><br> Middle


Name: <input type="text" name="mname"><br><br> Last Name:
<input type="text" name="lname"><br><br> Email: <input
type="email" name="email"><br><br> Phone:<input type="number"
name="ph"><br><br> Country:<select id='s'>
<option> </option>
<option>India</option>
<option>America</option>
<option>Australia</option>
<option>Sweden</option>
<option>Africa</option>

</select>

<br><br><br>
Address:<textarea rows="5" cols="25" value="g" required></textarea><br><br><br>
<br><input type ="submit" value="Submit" >

</form>

</div>
</center>
</body>
</html>
OUTPUT:
Program:

Index.html Page:

<html>

<head>

<title>Start</title>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

</head>

<body>

<center><h1 style="background-color:MediumSeaGreen;">Welcome To Sinhgad Academy Of


Engineering</h1></center><br><br>

<a href="Signin.html"><center><input type="button" value="Login" style="width:160px;font-


size:20pt;color:black;

background-color:MediumSeaGreen;"></center></a>
<br>

<a href="registration.html"><center><h2><input type="button"


value="Registration" style="width:160px;font-size:20pt;color:black;

background-color:MediumSeaGreen;"></h2></center></a>

<br><br>

</body>

</html>

Signin.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF- 8">


<title>Sign In JSP</title>

<%@ page import="java.sql.*" %>

<%@ page import="javax.sql.*" %>


<%@ page import="java.io.*" %>

</head>

<body>

<%

String user=request.getParameter("username"); String

pword=request.getParameter("password");

try{

Class.forName("com.mysql.jdbc.Driver");

Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/stud", "root",


"");

String sql="select * from reg where username=? and password=?";

PreparedStatement pst=conn.prepareStatement(sql); pst.setString(1,

user);

pst.setString(2,pword);

ResultSet rs=pst.executeQuery();

if(rs.next())

%>

<jsp:forward page="home.jsp"/>

<%

else

%>
<jsp:forward page="Signin.html"/>

<%

catch(Exception e){

System.out.println(e);

%>

</body>

</html>

Signin.html

<html>

<head>

<title>Login Page</title>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

</head>

<body>

<form action="Signin.jsp" id="std" method="POST" >

<center>Username : <input type="text" name="username" id="user"


style="width:200px;font-size:15pt;" ><br><br></center>

<center>Password : <input type="password" name="password" id="pass"


style="width:200px;font-size:15pt;" ></center><br>
<center><input type="submit" name="login" value="Login" id="sub"
style="width:160px;font-size:20pt;color:black;

background-color:grey;">&ensp;&ensp;&ensp;&ensp;

<input type="reset" value="Reset" style="width:160px;height:38px;font-


size:20pt;color:black; background-color:grey;"></center>

</form>

</body>

</html>

home.jsp

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Student Information</title>
<%@ page import="java.sql.*" %>

<%@ page import="javax.sql.*" %>

<%@ page import="java.io.*" %>

</style>

</head>

<body style="font-family:Veranda,sans-serif;">

<center>

<div class="header">Student Information</div>

<br><br><br>

<%

try{

Class.forName("com.mysql.jdbc.Driver");

Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/stud", "root",


"");

String sql="select * from info";

PreparedStatement pst=conn.prepareStatement(sql);

ResultSet rs=pst.executeQuery();

out.print("<table border=3px solid red>");

//width=\"100%\">

out.print("<tr style=\"background-color:#ff5b5b;color:white;\">");

out.print("<th colspan=\"5\">C3 Student Information</th>");

out.print("</tr>");

out.print("<tr>");

out.print("<th>Name</th>");

out.print("<th>Address</th>");
out.print("</tr>");

while(rs.next())

out.print("<tr>");

out.print("<td>");

out.print(rs.getString("name"));

out.print("</td>");

out.print("<td>");

out.print(rs.getString("address"));

out.print("</td>");

out.print("</tr>");

catch(Exception e)

System.out.println(e);

%>

<hr/>

<% %>

<a href="index.html" style="hover:green;"><button class="button logout">Logout</button></a>

<hr/>

</body>

</html>
registration.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01


Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Sign Up JSP</title>

</head>

<body>

<%@ page import="java.sql.*" %>

<%@ page import="javax.sql.*" %>

<%@ page import="java.io.*" %>

<%
String gender=request.getParameter("gender");

String email=request.getParameter("email"); String

college=request.getParameter("college"); String

branch=request.getParameter("branch"); String

mobile=request.getParameter("mobile");

String username=request.getParameter("username");

String pass=request.getParameter("password");

System.out.println(name); try{

Class.forName("com.mysql.jdbc.Driver");

Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/stud", "root",


"");

String sql="insert into


reg(name,gender,email,college,branch,mobile,username,password) values(?,?,?,?,?,?,?,?)";

PreparedStatement pst=conn.prepareStatement(sql);

pst.setString(1, name);

pst.setString(2, gender);

pst.setString(3, email);

pst.setString(4, college);

pst.setString(5, branch);

pst.setString(6, mobile);

pst.setString(7, username);

pst.setString(8, pass);

pst.executeUpdate();
%>

alert('Registered Successfully!');
<jsp:forward page="Signin.html"/>

<%

catch(Exception e)

System.out.println(e);

%>

</body>

</html>

registration.html

<!DOCTYPE html>

<html>

<head>

<title>Registration</title>

</head>

<body>

<center><h1 style="background-color:Tomato;">Student Registration</h1></center>

<hr />
<br>

<form id="fr" action="registration.jsp" method="POST">

<br>

<center> Name* :&ensp; &ensp; <input type="text" name="name" id="name" placeholder="Enter


name" style="width:200px;font-size:12pt;color:black; " ></center>

<br><br>

<center>Gender Type*:&ensp;&ensp; <input type="radio" name="gender" value="male"


>Male&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;

<input type="radio" name="gender" value="female" >Female </center><br><br>

<center>Email id *:&ensp; <input type="text" name="email" id="email" placeholder="Enter email"


style="width:200px;font-size:12pt;color:black;" ></center>

<br><br>

<center>College *:&ensp;&ensp; <input type="text" name="college" id="college"


placeholder="Enter College" style="width:200px;font-size:12pt;color:black;"
></center>

<br><br>

<center>Branch *: &ensp;&ensp;<input type="text" name="branch" id="branch"


placeholder="Enter Branch" style="width:200px;font-size:12pt;color:black;" ></center>

<br><br>

<center>Mobile No *:<input type="text" name="mobile" id="mobile" placeholder="Enter Mobile


no" style="width:200px;font-size:12pt;color:black;" ></center>

<br><br>

<center>Username *: <input type="text" name="username" id="username"


placeholder="Enter username" style="width:200px;font-size:12pt;" ><br><br></center>

<center>Password *: <input type="password" name="password" id="password"


placeholder="Enter Password" style="width:200px;font-size:12pt;" ></center><br>
<center><input type="submit" value="Submit" style="width:100px;font-size:15pt;color:black;
background-color:blue;" >&ensp;

&ensp;&ensp;&ensp;

<input type="reset" value="Reset" style="width:100px;font-size:15pt;color:black; background-


color:blue;"></center>

<br><br>

<hr />

<center><p style="font-size:15pt;color:black;">(*) Field indicates field is mandatory!!</p></center>

</form>

</body>

</html>
Code:

 db_connect.php

<?php

$conn=mysqli_connect('localhost','root','','assignment6');

if(mysqli_connect_errno())

{ echo 'Connection error';

?>

 index.php
<?php

session_start();

if(!isset($_SESSION['email']))

$_SESSION['email']='';

?>

<html>

<head><title>Home Page</title>

<style>

.button {
background-color:white;

color:black; padding:5px;

text-align:center;

padding:15px 30px;

transition-duration:0.4s;

border-radius:4px;

font-size:25px;

.top {

background-color:#ff5b5b;

color:white;

padding:5px; text-

align:center;

padding:15px 30px;

font-size:25px;

float:left; border:none;

width:50%;

</style>

</head>

<body style="font-family:Veranda,sans-serif;">

<div class="top_bar">

<a href="index.php"><button class="top">Home</button></a>

<a href="abt.php"><button class="top">About Us</button></a>

</div>
<center>

<a style="clear:left;" href="s_in.php"><button style="margin-top:10%;"


class="button s_in">Sign-in</button></a>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<a href="s_up.php"><button class="button s_up">Sign-up</button></a>

</center>

</body>

</html>

 s_in.php
<html>

<head><title>Sign-in to your account</title>

<style>

.header { margin-

top:5px;

margin-bottom:10%;

border-left:2px solid #4CAF50;

border-top:2px solid #4CAF50; border-

right:2px solid #008CBA; border-

bottom:2px solid #008CBA;

padding:8px;

font-size:30px; text-

align:center;

.top {

background-color:#ff5b5b;

color:white;
text-align:center;

padding:15px 30px;

font-size:25px;

float:left; border:none;

width:50%;

margin-bottom:10px;

.button {

background-color:white;

color:black;

text-align:center;

padding:10px 15px;

transition-duration:0.4s;

border-radius:4px;

font-size:20px;

</style>

</head>

<body style="font-family:Veranda,sans-serif;">

<div class="top_bar">

<a href="index.php"><button class="top">Home</button></a>

<a href="abt.php"><button class="top">About Us</button></a>

</div>

<center>

<div style="clear:left;" class="header">Sign-in to your Account</div>


<form action="login_validate.php" method="POST">

<table>

<tr><td>Email:</td><td style="text-align:center;"><input type="text" id="email"


name="email" placeholder="Enter your email id" class="login"></td></tr>

<tr><td>Password:</td><td style="text-align:center;"><input type="password" id="pword"


name="pword" placeholder="Enter your password" class="login"></td></tr>

</table>

<br><br>

<button type="submit" name="submit" class="button s_in">Login</button>

&nbsp;&nbsp;&nbsp;&nbsp;

<button type="reset" name="reset" class="button reset">Reset</button>

</form>

</center>

</body>

</html>

 login_validate.php
<?php

require 'db_connect.php';

session_start();

$email=$_POST['email'];

$pword=$_POST['pword'];

$query="select * from registration_details where email='$email' AND pword='$pword' ";

$result=mysqli_query($conn,$query);

if(mysqli_num_rows($result)>0)

$_SESSION['email']=$email;

?>

<script>location.href="s_info.php";</script>
<?php

else {

?>

<script>alert('Please check email id or password');

location.href="s_in.php";

</script>

<?php

?>

 s_up.php
<html>

<head><title>Sign-up for a new account</title>

<style>

.top {

background-color:#ff5b5b;

color:white;

text-align:center;

padding:15px 30px;

font-size:25px;

float:left; border:none;

width:50%;

margin-bottom:10px;

.header { margin-

top:5px;
margin-bottom:5%;

border-left:2px solid #4CAF50;

border-top:2px solid #4CAF50; border-

right:2px solid #008CBA; border-

bottom:2px solid #008CBA;

padding:8px;

font-size:30px; text-

align:center;

.button {

background-color:white;

color:black; padding:10px

15px;

text-align:center; border-

radius:4px; transition-

duration:0.4s; font-

size:20px;

</style>

</head>

<body style="font-family:Veranda,sans-serif;">

<div class="top_bar">

<a href="index.php"><button class="top">Home</button></a>

<a href="abt.php"><button class="top">About Us</button></a>

</div>

<center>
<div style="clear:left;"class="header">Sign-up for a new account</div>

</center>

<div>

<form id="sign_up" action="reg_user.php" method="POST">

<center>

<table>

<tr><td>First Name:</td><td style="text-align:center;"><input type="text"


id="fname" name="fname" placeholder="Saad" class="info"></td></tr>

<tr><td>Last Name:</td><td style="text-align:center;"><input type="text"


id="lname" name="lname" placeholder="Shaikh" class="info"></td></tr>

<tr><td>Gender:</td><td style="text-align:center;"><input type="radio" name="gender"


id="mradio" value="Male" checked>Male &nbsp;&nbsp;&nbsp; <input type="radio"
name="gender" id="fradio" value="Female">Female</td></tr>

<tr><td>Age:</td><td style="text-align:center;"><input type="text" id="age"


name="age" placeholder="20" class="info"></td></tr>

<tr><td>Mobile No.:</td><td style="text-align:center;"><input type="text" id="mno"


name="mno" placeholder="123456789" class="info"></td></tr>

<tr><td>Address:</td><td style="text-align:center;"><input type="text" id="add"


name="add" placeholder="Ganga Savera" class="info"></td></tr>

<tr><td>Email ID:</td><td style="text-align:center;"><input type="email" id="email"


name="email" placeholder="[email protected]" class="info"></td></tr>

<tr><td>Password:</td><td style="text-align:center;"><input type="text" id="pword"


name="pword" placeholder="********" class="info"></td></tr>

</table>

</center>

<br><br>

<center>

<button type="submit" class="button register">Register</button>

&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;
</center>

</form>

</div>

</body>

</html>

 reg_user.php
<?php

require 'db_connect.php';

$fname=$_POST['fname'];

$lname=$_POST['lname'];

$gender=$_POST['gender'];

$age=$_POST['age'];

$mno=$_POST['mno'];

$add=$_POST['add'];

$email=$_POST['email'];

$pword=$_POST['pword'];

$query="insert into
registration_detailsvalues('$fname','$lname','$gender','$age','$mno','$add','$email','$pword')";

if(mysqli_query($conn,$query))

?>

<script>alert('Registered Successfully!'); location.href="s_in.php";

</script>

<?php
}

else {

echo 'Error: '.mysqli_error($conn);

?>

 s_info.php
<?php

require 'db_connect.php';

session_start();

if($_SESSION['email']=='')

?>

<script>alert('Please login to the system first!');

location.href="s_in.php";</script>

<?php

else{

$query="select * from s_info";

$result=mysqli_query($conn,$query);

$info=mysqli_fetch_all($result,MYSQLI_ASSOC);

mysqli_free_result($result); mysqli_close($conn);

?>

<html>
<style>

.header { margin-

top:5px;

margin-bottom:5%;

border-left:2px solid #4CAF50;

border-top:2px solid #4CAF50; border-

right:2px solid #008CBA; border-

bottom:2px solid #008CBA;

padding:8px;

font-size:30px; text-

align:center;

.button {

background-color:white;

color:black;

text-align:center;

padding:10px 15px;

transition-duration:0.4s;

border-radius:4px;

font-size:20px;

tr:nth-child(even) {background-color:#efefef;}

.tablebtn:link, .tablebtn:visited

{ background-color: white;

color: black;
padding: 5px 5px; text-

align: center; text-

decoration: none;

display: inline-block;

transition-duration:0.4s;

border-radius:4px;

border:1px solid #ff5b5b;

</style>

</head>

<body style="font-family:Veranda,sans-serif;">

<center>

<div class="header">Student Information</div>

<br><br><br>

<table width="100%">

<tr>

<thcolspan="6">C3 Student Information</th>

</tr>

<tr style="background-color:#ff5b5b;color:white;">

<th>Roll No.</th>

<th>First Name</th>

<th>Last Name</th>

<th>Gender</th>

<th>Mobile No.</th>

<th>Action</th>

</tr>

<?phpforeach($info as $row){ ?>


<td><?php echo $row['rollno']; ?></td>

<td><?php echo $row['first_name']; ?></td>

<td><?php echo $row['last_name']; ?></td>

<td><?php echo $row['gender']; ?></td>

<td><?php echo $row['mobile_number']; ?></td>

<td>

<a href="update.php?rollno=<?php echo $row['rollno']; ?>"

class="tablebtn">Update</a> &nbsp;&nbsp;&nbsp;&nbsp;

<a href="delete.php?rollno=<?php echo $row['rollno']; ?>" class="tablebtn">Delete</a>

</td>

</tr>

<?php }?>

</table>

<a href="insert.php"><button type="button" name="insert" class="button insert" style="margin-


top:5%;">Insert</button></a>

<a href="logout.php"><button style="position:absolute; top:12%; right:3%;" class="button


logout">Logout</button></a>

</center>

</body>

</html>

 insert.php
<?php

session_start();

if($_SESSION['email']=='')

?>

<script>alert('Please login to the sytsem first!');

location.href="s_in.php";</script>
<?php

?>

<html>

<head><title>Insert Student Information</title>

<style>

.header { margin-

top:5px;

margin-bottom:5%;

border-left:2px solid #4CAF50; border-

top:2px solid #4CAF50; border-right:2px

solid #008CBA; border-bottom:2px solid

#008CBA; padding:8px;

font-size:30px; text-

align:center;

.button {

background-color:white;

color:black;

text-align:center;

padding:10px 15px;

transition-duration:0.4s;

border-radius:4px;

font-size:20px;
}

</style>

</head>

<body style="font-family:Veranda,sans-serif;">

<center>

<div class="header">Insert Records to Table</div>

<br><br><br>

<form action="insert_rec.php" method="POST">

<table>

<tr><td>First Name:</td><td style="text-align:center;"><input type="text" id="fname"


name="fname" placeholder="Enter first name" class="addrec"></td></tr>

<tr><td>Last Name:</td><td style="text-align:center;"><input type="text" id="lname"


name="lname" placeholder="Enter last name" class="addrec"></td></tr>

<tr><td>Gender:</td><td style="text-align:center;"><input type="text" id="gender"


name="gender" placeholder="Enter the gender" class="addrec"></td></tr>

<tr><td>Mobile No.:</td><td style="text-align:center;"><input type="text" id="mno"


name="mno" placeholder="Enter the mobile no" class="addrec"></td></tr>

</table>

<br><br>

<button type="submit" name="submit" class="button insert">Insert</button>

&nbsp;&nbsp;&nbsp;&nbsp;
<button type="reset" name="reset" class="button reset">Reset</button>

</form>

</center>

<a href="s_info.php"><button style="position:absolute; top:12%; left:3%;"


class="button back">Back</button></a>

</body>

</html>

 insert_rec.php
<?php

require 'db_connect.php';

session_start();

if($_SESSION['email']=='')

?>

<script>alert('Please login to the system first!');

location.href="s_in.php";</script>

<?php

else{

$fname=$_POST['fname'];

$lname=$_POST['lname'];

$gender=$_POST['gender'];

$mno=$_POST['mno'];

if($fname!='' && $lname!='' && $gender!='' && $mno!='')


{

$query="insert into s_info(first_name,last_name,gender,mobile_number)


values('$fname','$lname','$gender','$mno')";

if(mysqli_query($conn,$query))

?>

<script>alert('Inserted Successfully!');

location.href="s_info.php";

</script>

<?php

else {

echo 'Error: '.mysqli_error($conn);

else {

?>

<script>alert('Please fill in all fields!');

location.href="insert.php";</script>

<?php

?>

 update.php
<?php
require 'db_connect.php';

session_start();

if($_SESSION['email']=='')

?>

<script>alert('Please login to the system first!');

location.href="s_in.php";</script>

<?php

else{

$rollno=$_GET['rollno'];

$query="select * from s_info where rollno='$rollno'";

$result=mysqli_query($conn,$query);

$info=mysqli_fetch_assoc($result);

?>

<html>

<head><title>Update Student Information</title>

<style>

.header { margin-

top:5px;

margin-bottom:5%;

border-left:2px solid #4CAF50; border-

top:2px solid #4CAF50; border-

right:2px solid #008CBA;


border-bottom:2px solid #008CBA;

padding:8px;

font-size:30px; text-

align:center;

.button {

background-color:white;

color:black;

text-align:center;

padding:10px 15px;

transition-duration:0.4s;

border-radius:4px;

font-size:20px;

</style>

</head>

<body style="font-family:Veranda,sans-serif;">

<center>

<div class="header">Update Existing Record</div>

<br><br><br>

<form action="update_rec.php?rollno=<?php echo $rollno; ?>" method="POST">

<table>

<tr><td>First Name:</td><td style="text-align:center;"><input type="text" id="fname"


name="fname" value="<?php echo $info['first_name']; ?>" class="updtrec"></td></tr>

<tr><td>Last Name:</td><td style="text-align:center;"><input type="text" id="lname"


name="lname" value="<?php echo $info['last_name']; ?>" class="updtrec"></td></tr>
<tr><td>Gender:</td><td style="text-align:center;"><input type="text" id="gender"
name="gender" value="<?php echo $info['gender']; ?>" class="updtrec"></td></tr>

<tr><td>Mobile No.:</td><td style="text-align:center;"><input type="text" id="mno"


name="mno" value="<?php echo $info['mobile_number']; ?>"
class="updtrec"></td></tr>

</table>

<br><br>

<button type="submit" name="submit" class="button update">Update</button> &nbsp;&nbsp;&nbsp;&nbsp;

<button type="reset" name="reset" class="button reset">Reset</button>

</form>

</center>

<a href="s_info.php"><button style="position:absolute; top:12%; left:3%;"


class="button back">Back</button></a>

</body>

</html>

 update_rec.php
<?php

require 'db_connect.php';

session_start();

if($_SESSION['email']=='')

?>

<script>alert('Please login to the system first!');


location.href="s_in.php";</script>

<?php

else {

$rollno=$_GET['rollno'];

$fname=$_POST['fname'];

$lname=$_POST['lname'];

$gender=$_POST['gender'];

$mno=$_POST['mno'];

if($fname!='' && $lname!='' && $gender!='' && $mno!='')

$query="update s_info set


first_name='$fname',last_name='$lname',gender='$gender',mobile_number='$mno' where
rollno='$rollno'";

if(mysqli_query($conn,$query))

?>

<script>alert('Updated Successfully!');

location.href="s_info.php";

</script>

<?php

else {

echo 'Error: '.mysqli_error($conn);

else {
?>

<script>alert('Please fill in all fields!'); location.href="update.php?rollno=<?

php echo $rollno; ?>";</script>

<?php

?>

 delete.php
<?php

require 'db_connect.php';

session_start();

if($_SESSION['email']=='')

?>

<script>alert('Please login to the system first!');

location.href="s_in.php";</script>

<?php

else {

$rollno=$_GET['rollno'];

$query="delete from s_info where rollno='$rollno'";

if(mysqli_query($conn,$query))

?>
<script>alert('Deleted Successfully!');

location.href="s_info.php";

</script>

<?php

else {

echo 'Error: '.mysqli_error($conn);

?>

 logout.php
<?php session_start();

session_destroy();

?>

<script>location.href="index.php";</script>

Output:
Code:

● getvalues.php

<!DOCTYPE html>

<html>

<head>

<title></title>

</head>

<body>

<?php

$role=$_GET['p'];

if($role==1)

$sel_role="Developer";

} else if($role==2)

$sel_role="Tester";

} else if($role==3)

$sel_role="Technician";

} else if($role==4)

$sel_role="Salesperson";
}

$conn=mysqli_connect("localhost","root","","ajax");

$result=mysqli_query($conn,"select * from employee_data where role='$sel_role'");

echo "<table width='50%'>

<tr style='background-color:#ff5b5b;color:white;'>

<th>id</th>

<th>name</th>

<th>salary</th>

<th>email</th>

</tr>";

while ($row=mysqli_fetch_array($result))

echo "<tr>";

echo "<td>".$row['id']."</td>";

echo "<td>".$row['name']."</td>";

echo "<td>".$row['salary']."</td>";

echo "<td>".$row['email']."</td>";

echo "</tr>";

} echo "</table>";

?>

</body>

</html>

● view_records.php

<!DOCTYPE html>
<html>

<title></title>

<script type="text/javascript">

functionshowUser(role_val)

varxmlhttp = new XMLHttpRequest();

xmlhttp.onreadystatechange=function(){

if(this.readyState==4 &&this.status==200)

console.log('Result:'+this.responseText);

document.getElementById("table1").innerHTML=this.responseText;

};

xmlhttp.open("GET","getvalues.php?p="+role_val,true);

xmlhttp.send();

</script>

<style type="text/css">

.header { margin-

top:3%;

margin-bottom:5%;

border-left:2px solid #4CAF50;

border-top:2px solid #4CAF50; border-

right:2px solid #008CBA; border-

bottom:2px solid #008CBA;

padding:8px;

font-size:30px; text-
}

table {

text-align:center;

border-collapse:collapse;

font-size:20px;

tr:nth-child(even) {background-color:#efefef;}

select {

width:130px;

height:30px;

</style>

</head>

<body>

<center>

<div class="header">View Employee Details</div>

<form>

<div>

<select name="users" onchange="showUser(this.value)">

<option value="select">Select a person:</option> <option

value="1">Developer</option> <option

value="2">Tester</option>

<option value="3">Technician</option>

<option value="4">Salesperson</option>

</select>
</div>

</form>

<br><br><br>

<div id="table1">

</div>

</center>

</body>

</html>

Output:
Program:

login.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF- 8">


<title>JSP Page</title>

</head>

<body>

<h1>Login</h1>

<form action="loginform.do" method="post"> username

<input type="text" name="uname"/><br/> password

<input type="password" name="upass"/><br/> <input

type="submit" value="Login"/>

</form>

</body>

</html>

success.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF- 8">


<title>JSP Page</title>

</head>

<body>

<h1>Success Page</h1>

</body>

</html>

failure.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF- 8">


<title>JSP Page</title>

</head>

<body>

<h1>Failure page</h1>

</body>

</html>

loginbean.java

package com.myapp.struts;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors; import

org.apache.struts.action.ActionMapping; import

org.apache.struts.action.ActionMessage;

/**

* @author hp

*/

public class loginbean extends org.apache.struts.action.ActionForm {

private String uname;

private String upass;

public String getUname()

{ return uname;

public void setUname(String uname)

{ this.uname = uname;

public String getUpass()

{ return upass;

}
public void setUpass(String upass)

{ this.upass = upass;

public loginbean()

{ super();

// TODO Auto-generated constructor stub

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)

{ ActionErrors errors = new ActionErrors();

return errors;

loginform.java

package com.myapp.struts;

import javax.servlet.http.HttpServletRequest; import

javax.servlet.http.HttpServletResponse; import

org.apache.struts.action.ActionForm; import

org.apache.struts.action.ActionForward; import

org.apache.struts.action.ActionMapping;
public class loginform extends org.apache.struts.action.Action {

/* forward name="success" path="" */ private

static final String SUCCESS = "success"; private

static final String FAILURE = "failure";

@Override

public ActionForward execute(ActionMapping mapping, ActionForm form,

HttpServletRequest request, HttpServletResponse response) throws

Exception {

loginbean lb = (loginbean)form;

if(lb.getUname().equals("abc") && lb.getUpass().equals("123"))

return mapping.findForward(SUCCESS);

else

return mapping.findForward(FAILURE);

structs-config.xml

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts-config PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"

"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<struts-config>

<form-beans>

<form-bean name="loginbean" type="com.myapp.struts.loginbean"/>

</form-beans>

<global-exceptions>

</global-exceptions>

<global-forwards>

<forward name="failure" path="/failure.jsp"/>

<forward name="success" path="/success.jsp"/>

<forward name="welcome" path="/Welcome.do"/>

</global-forwards>

<action-mappings>

<action name="loginbean" path="/loginform" scope="request"


type="com.myapp.struts.loginform" validate="false"/>

<action path="/Welcome"
forward="/welcomeStruts.jsp"/> </action-mappings>

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

<message-resources parameter="com/myapp/struts/ApplicationResource"/>

<plug-in className="org.apache.struts.tiles.TilesPlugin" >


<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"

/> <set-property property="moduleAware" value="true" />

</plug-in>

<!-- ========================= Validator plugin ================================= -->

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">

<set-property

property="pathnames"

value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>

</plug-in>

</struts-config>

web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-
app_3_1.xsd">

<servlet>

<servlet-name>action</servlet-name> <servlet-

class>org.apache.struts.action.ActionServlet</servlet-class> <init-

param>

<param-name>config</param-name> <param-
value>/WEB-INF/struts-config.xml</param-value>

</init-param>

<init-param>

<param-name>debug</param-name>
<param-value>2</param-value>

</init-param>

<init-param>

<param-name>detail</param-name>

<param-value>2</param-value>

</init-param>

<load-on-startup>2</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>

<session-config>

<session-timeout> 30

</session-timeout>

</session-config>

<welcome-file-list>

<welcome-file>login.jsp</welcome-file>

</welcome-file-list>

<jsp-config>

<taglib>

<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri> <taglib-
location>/WEB-INF/struts-bean.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri> <taglib-
location>/WEB-INF/struts-logic.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri> <taglib-
location>/WEB-INF/struts-nested.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri> <taglib-
location>/WEB-INF/struts-tiles.tld</taglib-location>

</taglib>

</jsp-config>

</web-app>

Output:
Program:

<html>

<head>

<script src="angular.js"></script>

</head>

<body>

<hr><br>

<center><h2>Shopping Card Record</h2></center>

<div data-ng-app="myapp" data-ng-controller="CartForm


<center><br>

<hr>

<br><br>

<table class="table" >

<table border="10" >

<tr>

<th>Description</th>

<th>Qty</th>

<th>Cost</th>

<th>Total</th>

<th>Remove</th>

</tr>

<tr ng:repeat="item in cart.items">

<td><input type="text" ng:model="item.description"></td> <td><input

type="number" ng:model="item.qty" ng:required></td> <td><input

type="number" ng:model="item.cost" ng:required></td>

<td>{{item.qty * item.cost | currency:'Rs '}}</td>

<td>[<a href ng:click="removeItem($index)">X</a>]</td>

</tr>

<tr>

<td><a href ng:click="addItem()">add item</a></td>

<td></td>

<td>Total:</td>

<td>{{total() | currency:'Rs '}}</td>

</tr>

</table>
<script>

var app=angular.module('myapp',[]);

app.controller('CartForm', function($scope)

$scope.cart =

items: [{ qty: '', description: '', cost: ''}]

$scope.addItem = function()

$scope.cart.items.push({ qty: '', description: '', cost: ''});

$scope.removeItem = function(index)

$scope.cart.items.splice(index, 1);

$scope.total = function()

var total = 0;

angular.forEach($scope.cart.items, function(item)

total += item.qty * item.cost;

})

return total;

}
</script>

</body>

</html>

Output:
Code:

Index.html

<html>

<head>

<title>Implement Bank Application using EJB</title>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

</head>

<body>

<form method="post" action="transact">

<h1>Bank Application using EJB </h1>

Enter Amount : <input type="text" name="t1" />

<h3>Select option</h3>

<input type="radio" name="transaction"value="deposite" />Deposite<br/>

<input type="radio" name="transaction"value="withdraw" />withdraw<br/>

<input type="submite" value="submite" />

</form>

</body>

transact.java

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

public class transact extends httpServlet {

protected void processRequest(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

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 initialContext();

return(BankTransactLocal)c.Lookup("java.global/Bank/Bank-ejb/BankTransact!
Bankexamp.Bank/Bank-ejb/BankTransactLocal")

catch (NamingException ne){

Logger.getLogger(getClass().getName().log(Level.SEVERE,"exception caught",ne))

throw new RuntimeException(ne);

BankTransact.java

//this is session Bean

package bankexamp;

inport javax.ejb.Statful;

@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:

You might also like