WT Manual With Code
WT Manual With 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:
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">
</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;
}
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 -->
</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">
</head>
<body>
background-color:MediumSeaGreen;"></center></a>
<br>
background-color:MediumSeaGreen;"></h2></center></a>
<br><br>
</body>
</html>
Signin.jsp
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<%
pword=request.getParameter("password");
try{
Class.forName("com.mysql.jdbc.Driver");
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">
</head>
<body>
background-color:grey;">    
</form>
</body>
</html>
home.jsp
<html>
<head>
<title>Student Information</title>
<%@ page import="java.sql.*" %>
</style>
</head>
<body style="font-family:Veranda,sans-serif;">
<center>
<br><br><br>
<%
try{
Class.forName("com.mysql.jdbc.Driver");
PreparedStatement pst=conn.prepareStatement(sql);
ResultSet rs=pst.executeQuery();
//width=\"100%\">
out.print("<tr style=\"background-color:#ff5b5b;color:white;\">");
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/>
<% %>
<hr/>
</body>
</html>
registration.jsp
pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Sign Up JSP</title>
</head>
<body>
<%
String gender=request.getParameter("gender");
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");
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>
<hr />
<br>
<br>
<br><br>
<br><br>
<br><br>
<br><br>
<br><br>
   
<br><br>
<hr />
</form>
</body>
</html>
Code:
db_connect.php
<?php
$conn=mysqli_connect('localhost','root','','assignment6');
if(mysqli_connect_errno())
?>
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">
</div>
<center>
</center>
</body>
</html>
s_in.php
<html>
<style>
.header { margin-
top:5px;
margin-bottom:10%;
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">
</div>
<center>
<table>
</table>
<br><br>
</form>
</center>
</body>
</html>
login_validate.php
<?php
require 'db_connect.php';
session_start();
$email=$_POST['email'];
$pword=$_POST['pword'];
$result=mysqli_query($conn,$query);
if(mysqli_num_rows($result)>0)
$_SESSION['email']=$email;
?>
<script>location.href="s_info.php";</script>
<?php
else {
?>
location.href="s_in.php";
</script>
<?php
?>
s_up.php
<html>
<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%;
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">
</div>
<center>
<div style="clear:left;"class="header">Sign-up for a new account</div>
</center>
<div>
<center>
<table>
</table>
</center>
<br><br>
<center>
</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>
<?php
}
else {
?>
s_info.php
<?php
require 'db_connect.php';
session_start();
if($_SESSION['email']=='')
?>
location.href="s_in.php";</script>
<?php
else{
$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%;
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-
decoration: none;
display: inline-block;
transition-duration:0.4s;
border-radius:4px;
</style>
</head>
<body style="font-family:Veranda,sans-serif;">
<center>
<br><br><br>
<table width="100%">
<tr>
</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>
<td>
class="tablebtn">Update</a>
</td>
</tr>
<?php }?>
</table>
</center>
</body>
</html>
insert.php
<?php
session_start();
if($_SESSION['email']=='')
?>
location.href="s_in.php";</script>
<?php
?>
<html>
<style>
.header { margin-
top:5px;
margin-bottom:5%;
#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>
<br><br><br>
<table>
</table>
<br><br>
<button type="reset" name="reset" class="button reset">Reset</button>
</form>
</center>
</body>
</html>
insert_rec.php
<?php
require 'db_connect.php';
session_start();
if($_SESSION['email']=='')
?>
location.href="s_in.php";</script>
<?php
else{
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$gender=$_POST['gender'];
$mno=$_POST['mno'];
if(mysqli_query($conn,$query))
?>
<script>alert('Inserted Successfully!');
location.href="s_info.php";
</script>
<?php
else {
else {
?>
location.href="insert.php";</script>
<?php
?>
update.php
<?php
require 'db_connect.php';
session_start();
if($_SESSION['email']=='')
?>
location.href="s_in.php";</script>
<?php
else{
$rollno=$_GET['rollno'];
$result=mysqli_query($conn,$query);
$info=mysqli_fetch_assoc($result);
?>
<html>
<style>
.header { margin-
top:5px;
margin-bottom:5%;
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>
<br><br><br>
<table>
</table>
<br><br>
</form>
</center>
</body>
</html>
update_rec.php
<?php
require 'db_connect.php';
session_start();
if($_SESSION['email']=='')
?>
<?php
else {
$rollno=$_GET['rollno'];
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$gender=$_POST['gender'];
$mno=$_POST['mno'];
if(mysqli_query($conn,$query))
?>
<script>alert('Updated Successfully!');
location.href="s_info.php";
</script>
<?php
else {
else {
?>
<?php
?>
delete.php
<?php
require 'db_connect.php';
session_start();
if($_SESSION['email']=='')
?>
location.href="s_in.php";</script>
<?php
else {
$rollno=$_GET['rollno'];
if(mysqli_query($conn,$query))
?>
<script>alert('Deleted Successfully!');
location.href="s_info.php";
</script>
<?php
else {
?>
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");
<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)
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%;
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>
<form>
<div>
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
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Login</h1>
type="submit" value="Login"/>
</form>
</body>
</html>
success.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Success Page</h1>
</body>
</html>
failure.jsp
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Failure page</h1>
</body>
</html>
loginbean.java
package com.myapp.struts;
import javax.servlet.http.HttpServletRequest;
org.apache.struts.action.ActionMapping; import
org.apache.struts.action.ActionMessage;
/**
* @author hp
*/
{ return uname;
{ this.uname = uname;
{ return upass;
}
public void setUpass(String upass)
{ this.upass = upass;
public loginbean()
{ super();
return errors;
loginform.java
package com.myapp.struts;
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 {
@Override
Exception {
loginbean lb = (loginbean)form;
return mapping.findForward(SUCCESS);
else
return mapping.findForward(FAILURE);
structs-config.xml
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
</form-beans>
<global-exceptions>
</global-exceptions>
<global-forwards>
</global-forwards>
<action-mappings>
<action path="/Welcome"
forward="/welcomeStruts.jsp"/> </action-mappings>
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<message-resources parameter="com/myapp/struts/ApplicationResource"/>
</plug-in>
<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
<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>
<hr>
<br><br>
<tr>
<th>Description</th>
<th>Qty</th>
<th>Cost</th>
<th>Total</th>
<th>Remove</th>
</tr>
</tr>
<tr>
<td></td>
<td>Total:</td>
</tr>
</table>
<script>
var app=angular.module('myapp',[]);
app.controller('CartForm', function($scope)
$scope.cart =
$scope.addItem = function()
$scope.removeItem = function(index)
$scope.cart.items.splice(index, 1);
$scope.total = function()
var total = 0;
angular.forEach($scope.cart.items, function(item)
})
return total;
}
</script>
</body>
</html>
Output:
Code:
Index.html
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h3>Select option</h3>
</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;
response.setContentType("text/html;charset=UTF-8");
try {
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);
}
}
try{
return(BankTransactLocal)c.Lookup("java.global/Bank/Bank-ejb/BankTransact!
Bankexamp.Bank/Bank-ejb/BankTransactLocal")
Logger.getLogger(getClass().getName().log(Level.SEVERE,"exception caught",ne))
BankTransact.java
package bankexamp;
inport javax.ejb.Statful;
@Stateful
int balance=10000;
@override
balance=balance+amount;
return balance;
@override
balance=balance-amount
return balance;
Output: