Web Technologies
Class: CSE-
Regd.No:
Page No:
LAB CYCLE 1
Class: CSE-
Page No:
PROGRAM NO: 1
DATE:
AIM:
1. Create an HTML page having Four frames named
a. Top
b. Center
c. Bottom
d. Left
The Top frame should contain company logo and title. The bottom frame should contain
copy right information. The Left frame should contain various links like Home, Products,
Services, Branches, About us, etc. When we click on those links, the contents should
come in to Center Frame.
Frame.html
<html>
<head>
<title> Andhra Pradesh </title>
</head>
<frameset rows="20%, 70%, *">
<frame src= "title.html" name="title" />
<frameset cols="20%, *">
<frame src="link.html" name="links"/>
<frame src="desc.html" name="desc"/>
</frameset>
<frame src="rights.html" name="rights"/>
</frameset>
</html>
Title.html
<html>
<head>
<title> Andhra Pradesh</title>
</head>
<body bgcolor="orange" >
<center>
<font color= "red"><h1 > Andhra Pradesh</h1></font>
<font color= "green"><h3>The Sunrise State</h3></font>
</center>
Class: CSE-
Page No:
</body>
</html>
Link.html
<html>
<head>
<title> VIGNAN</title>
</head>
<body bgcolor=lightgreen alink="blue" >
<center> <br><br><br><br><br><br>
<A href="aboutus.html" target="desc"> About AP</A><br>
<A href="districts.html" target="desc">District </A><br>
<A href="tourism.html" target="desc">Tourist places</A><br>
</center>
</body>
</html>
Desc.html
<html>
<head>
<title>Andhra Pradesh</title>
</head>
<body >
<img src="andhra-1.jpg" width="100%">
</body>
</html>
Aboutus.html
<html>
<head>
<title> About Andhra Pradesh</title>
</head>
<body bgcolor="yellow">
<p>Andhra Pradesh is one of the 29 states of India, situated on the southeastern coast of the
country. The state is the eighth largest state in India covering an area of 160,205 km2 (61,855 sq
mi).[3] As per 2011 census of India, the state is tenth largest by population with 49,386,799
inhabitants. On 2 June 2014, the north-western portion of the state was bifurcated to form a new
state of Telangana.</p>
Class: CSE-
Page No:
</body>
</html>
Districts.html
<html>
<head>
<title> district </title>
</head>
<body bgcolor="yellow">
<br>Anantapur<br>
Chittor<br>
East Godavari<br>
Guntur<br>
Cuddapah<br>
Krishna<br>
Kurnool<br>
Prakasam<br>
Nellore<br>
Srikakulam<br>
Visakhapatnam<br>
Vizianagaram<br>
West Godavari<br>
</body>
Class: CSE-
Page No:
</html>
Tourism.html
<html>
<head>
<title>tourism</title>
</head>
<body>
<img src="t.jpeg" width="100%" height="100%"/>
</body>
</html>
Right.html
<html>
<head>
<title>Andhra Pradesh</title>
</head>
<body bgcolor=lightblue >
<center>All rights reserved@Andhra Pradesh Goverment </center>
</body>
</html>
Output:-
Regd.No:
Page No:
PROGRAM NO: 2
DATE:
AIM:
Create a HTML document to demonstrate Form Elements that includes Form, input-text,
password, radio, checkbox, hidden, button, submit, reset, label, textarea, select, option,
file upload.
<html>
<head>
<title>ONLINE APPLICATION FORM </title>
</head>
<body bgcolor=lightgreen>
<form>
<label for="Name">Name
<input type="name" name="Name" ><br>
Password<input type="password" name="password" ><br>
GENDER<BR>
MALE
<input type="radio" name="gen"/>
FEMALE <input type="radio" name="gen"/><br><br>
Qualification<br>
SSC<input type="checkbox" name="SSC><br>
Inter<input type="checkbox" name="Inter" ><br>
B.Tech<input type="checkbox" name="B.tech><br>
M.Tech<input type="checkbox" name="M.tech"><br>
Select state
<select>
<option value="Andhra Pradesh">Andhra Pradesh</option>
<option value="Tamilnadu">Tamilnadu</option>
Regd.No:
Page No:
<option value="Kerala">Kerala</option>
<option value="Chattisgarh">Chattisgarh</option>
</select><br>
file upload<input type="file" name="myfile" ><br>
<input type="hidden" value="INDIAN" >
<input type="submit" value="submit" >
<input type="reset" value="reset" >
<input type="button" value="cancel" >
</form>
</body>
</html>
OUTPUT:
Regd.No:
Page No:
PROGRAM NO: 3
DATE:
AIM:
Design an HTML having a text box and four buttons viz Factorial, Fibonacci, Prime, and
Palindrome. When a button is pressed an appropriate javascript function should be called to
display
a. Factorial of that number
b. Fibonacci series up to that number
c. Prime numbers up to that number
d. Is it palindrome or not
a)Factorial of that number
<HTML>
<BODY>
<script type="text/javascript">
document.write("<h2>Table of Factorials</h2>");
for(i = 1, fact = 1; i < 10; i++, fact *= i)
{
document.write(i + "! = " + fact);
document.write("<br>");
}
</script>
</BODY>
</HTML>
Regd.No:
Page No:
OUTPUT:
OUTPUT:
Regd.No:
Page No:
Class: CSE-
Page No:
</script>
<form >
Enter a String/Number: <input type="text" id="str" name="string" /><br />
<input type="submit" value="Check" onclick="checkPalindrome();"/>
</form>
</body>
</html>
OUTPUT:
d. Is it palindrome or not
<html>
<head>
<script language="javascript">
var a=prompt("enter a value");
alert(a);
var c=0;
for(var i=2;i<a;i++)
{
if(a%i==0)
{
c=i;
}
}
if(c==0)
{
alert("Given number is Prime");
}
else
{
alert("Given number is not Prime");
}
</script>
Class: CSE-
Page No:
</head>
<body>
</body>
</html>
OUTPUT:
PROGRAM NO: 4
DATE:
AIM:
Write java script programs to demonstrate
a. Math Object with at least five methods.
b. String Object with at least five methods.
c. Date Object with at least five methods.
d. Array Object with at least five methods
a. Math Object with at least five methods
<html>
<head>
<title>Java Script Math Object</title>
</head>
<body>
<script type="text/javascript">
document.write("Square root of 25 is"+Math.sqrt(25)+"<br>");
document.write(" 2 power 5 is is "+Math.pow(2,5)+"<br>");
document.write("Minimum value among 25 and 35 is"+Math.min(25,35)+"<br>");
document.write("Ceil of 1.11 is "+Math.ceil(1.11)+"<br>");
document.write("Floor of 1.11 is "+Math.floor(1.11)+"<br>");
Class: CSE-
Page No:
Class: CSE-
Page No:
document.writeln("<br> ");
document.write("(1,3):" +str1.substring(1,3));
document.writeln("<br> ");
document.write("Concatation ="+str1.concat(str2));
document.writeln("<br> ");
document.write(str2);
</script>
</body>
</html>
OUTPUT:
Class: CSE-
Page No:
</html>
OUTPUT:
Class: CSE-
Page No:
PROGRAM NO: 5
DATE:
AIM:
Write a java script program to display message on OnBlur and OnFocus events.
<html>
<head>
</head>
<body>
name:<input type="text" id="name" onblur="myfunction()"
onfocus="myfunction()">
<script>
function myfunction()
{
var x=document.getElementById("name");
x.value=x.value.toUpperCase();
x.style.background="blue";
Class: CSE-
Page No:
}
</script>
</body>
</html>
OUTPUT:-
PROGRAM NO: 6
DATE:
AIM:
Create an XML document where CSEBooks is the root tag,it consists of 5 books named
as(book1, book2, book3, book4, book5) whose copies of books are 10 and provide the
child tag such as author,title,pages,price for all books
<?xml version="1.0" encoding="UTF-08" ?>
<!DOCTYPE cse SYSTEM "1.dtd">
<cse>
<book1>
<author>bates</author>
<title>wt</title>
<pages>300</pages>
<price>500</price>
Regd.No:
Page No:
</book1>
<book2>
<author>bates</author>
<title>wt</title>
<pages>300</pages>
<price>500</price>
</book2>
<book3>
<author>bates</author>
<title>wt</title>
<pages>300</pages>
<price>500</price>
</book3>
<book4>
<author>bates</author>
<title>wt</title>
<pages>300</pages>
<price>500</price>
</book4>
<book5>
<author>bates</author>
<title>wt</title>
<pages>300</pages>
<price>500</price>
</book5>
</cse>
1.dtd:
<!ELEMENT cse(book1+,book2+,book3+,book4+,book5+)>
<!ELEMENT book1(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
<!ELEMENT book2(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
<!ELEMENT book3(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
Class: CSE-
Page No:
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
<!ELEMENT book4(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
<!ELEMENT book5(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
OUTPUT:
Regd.No:
Page No:
PROGRAM NO: 6
DATE:
AIM:
For the above program, provide an associate DTD.
<!ELEMENT cse(book1+,book2+,book3+,book4+,book5+)>
<!ELEMENT book1(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
<!ELEMENT book2(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
<!ELEMENT book3(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
<!ELEMENT book4(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
Regd.No:
Page No:
<!ELEMENT book5(author,title,pages,price)>
<!ELEMENT author(#PCDATA)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT pages(#PCDATA)>
<!ELEMENT price(#PCDATA)>
PROGRAM NO: 7
DATE:
AIM:
Create an XML document where automobiles is the root tag, it consists of 5 vehicles
named as (vehicle1, vehicle2, vehicle3, vehicle4,vehicle5) and use attributes type, model,
engine no, color, cc.
<?xml version="1.0" encoding="UTF-8"?>
<automobiles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="2.xsd">
<vehicle1>
<type>bike</type>
<model>2016</model>
<color>pink</color>
<engineno>1234</engineno>
<cc>250</cc>
</vehicle1>
<vehicle2>
<type>car</type>
<model>2015</model>
<color>white</color>
<engineno>9999</engineno>
<cc>359</cc>
</vehicle2>
<vehicle3>
Regd.No:
Page No:
<type>scooty</type>
<model>2014</model>
<color>black</color>
<engineno>999</engineno>
<cc>159</cc>
</vehicle3>
<vehicle4>
<type>bus</type>
<model>2010</model>
<color>green</color>
<engineno>99</engineno>
<cc>150</cc>
</vehicle4>
<vehicle5>
<type>lorry</type>
<model>2000</model>
<color>red</color>
<engineno>9</engineno>
<cc>100</cc>
</vehicle5>
</automobiles>
1.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="automobile">
<xsd:ComplexType>
<xsd:sequence>
<xsd:element name="vehicle1">
<xsd:ComplexType>
<xsd:sequence>
<xsd:element name="type" type="xsd:string">
<xsd:element name="model" type="xsd:string">
<xsd:element name="color" type="xsd:string">
<xsd:element name="engineno" type="xsd:string">
<xsd:element name="cc" type="xsd:string">
</xsd:sequence>
</xsd:ComplexType>
</xsd:element>
<xsd:element name="vehicle2">
<xsd:ComplexType>
<xsd:sequence>
<xsd:element name="type" type="xsd:string">
<xsd:element name="model" type="xsd:string">
<xsd:element name="color" type="xsd:string">
<xsd:element name="engineno" type="xsd:string">
Regd.No:
Page No:
<xsd:element name="vehicle4">
<xsd:ComplexType>
<xsd:sequence>
<xsd:element name="type" type="xsd:string">
<xsd:element name="model" type="xsd:string">
<xsd:element name="color" type="xsd:string">
<xsd:element name="engineno" type="xsd:string">
<xsd:element name="cc" type="xsd:string">
</xsd:sequence>
</xsd:ComplexType>
</xsd:element>
</xsd:sequence>
</xsd:ComplexType>
</xsd:element>
</xsd:schema>
OUTPUT:
Regd.No:
Page No:
PROGRAM NO: 8
DATE:
AIM:
For the above program, provide an associated Schema
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="automobile">
<xsd:ComplexType>
<xsd:sequence>
<xsd:element name="vehicle1">
<xsd:ComplexType>
<xsd:sequence>
<xsd:element name="type" type="xsd:string">
<xsd:element name="model" type="xsd:string">
<xsd:element name="color" type="xsd:string">
<xsd:element name="engineno" type="xsd:string">
Regd.No:
Page No:
<xsd:element name="vehicle4">
<xsd:ComplexType>
<xsd:sequence>
<xsd:element name="type" type="xsd:string">
<xsd:element name="model" type="xsd:string">
<xsd:element name="color" type="xsd:string">
<xsd:element name="engineno" type="xsd:string">
<xsd:element name="cc" type="xsd:string">
</xsd:sequence>
</xsd:ComplexType>
</xsd:element>
</xsd:sequence>
</xsd:ComplexType>
</xsd:element>
</xsd:schema>
Regd.No:
Page No:
Regd.No:
Page No:
LAB CYCLE 2
Regd.No:
Page No:
Statement stmt=null;
Try
{
Class.forName(JDBC_DRIVER);
System.out.println("Connecting to DB");
con=DriverManager.getConnection(DB_URL,USER,PASS);
System.out.println("Connected");
System.out.println("creating table");
stmt=con.createStatement();
String sql="create table student(id INTEGER,name VARCHAR(20),sal INTEGER)";
stmt.executeUpdate(sql);
stmt.close();
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
output:
Regd.No:
Page No:
Statement stmt=null;
Try
{
Class.forName(JDBC_DRIVER);
System.out.println("Connecting to DB");
con=DriverManager.getConnection(DB_URL,USER,PASS);
System.out.println("Connected");
System.out.println("creating table");
stmt=con.createStatement();
String sql="insert into student values(6,'naga',2000)";
stmt.executeUpdate(sql);
System.out.println("inserted data");
stmt.close();
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
output:
Class: CSE-
Page No:
Connection con=null;
Statement stmt=null;
Try
{
Class.forName(JDBC_DRIVER);
System.out.println("Connecting to DB");
con=DriverManager.getConnection(DB_URL,USER,PASS);
System.out.println("Connected");
System.out.println("creating table");
stmt=con.createStatement();
String sql="select * from student";
ResultSetrs=stmt.executeQuery(sql);
System.out.println(" id name sal" );
while(rs.next())
{
int id=rs.getInt("id");
String name=rs.getString("name");
intsal=rs.getInt("sal");
System.out.println(id+" "+name+" "+sal );
}
stmt.close();
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
output:
Regd.No:
Page No:
Regd.No:
Page No:
import java.sql.*;
import java.io.*;
public class JDBC_UPD_Table
{
static final String JDBC_DRIVER="com.mysql.jdbc.Driver";
static final String DB_URL="jdbc:mysql://localhost:3306/EMPLOYEE";
static final String USER="root";
static final String PASS="";
public static void main(String[] args)
{
Connection con=null;
Statement stmt=null;
Try
{
Class.forName(JDBC_DRIVER);
System.out.println("Connecting to DB");
con=DriverManager.getConnection(DB_URL,USER,PASS);
System.out.println("Connected");
System.out.println("creating table");
stmt=con.createStatement();
System.out.println("table updating");
String sql="update student set name='hvr' where id=6";
stmt.executeUpdate(sql);
stmt.close();
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
output:
Regd.No:
Page No:
Regd.No:
Page No:
web.xml:
<web-app>
<servlet>
<servlet-name>RS</servlet-name>
<servlet-class>Register</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RS</servlet-name>
<url-pattern>/Register</url-pattern>
</servlet-mapping>
</web-app>
output: