Program:1
Program:1
<html>
<head>
<title>Basic html tags</title>
</head>
<body >
<font color="brown" font face="arial helvetica ">
<h1 align="center"><u>!!WELCOME!!</u></h1>
<h2 align="center">!!WELCOME!!</h2>
<h3 align="center">!!WELCOME!!</h3>
<h4 align="center">!!WELCOME!!</h4>
<h5 align="center">!!WELCOME!!</h5>
<h6 align="center">!!WELCOME!!</h6>
</font>
<font color="green" size=10>
<p>This is a <b><i>sample</i></b> of web page <br/>using basic
html tags like<br/>
</font>
<font size=6 color="blue">
<pre>headings,font <sub>colors,types,sizes
</sub>,alignments,subscripts,pretag</pre></p>
</font>
</body>
</html>
OUTPUT:
1
WPSLAB
OUTPUT:
2
WPSLAB
3
WPSLAB
<li><h4><p>located in cuzco,<i>PERU</i></p></h4></li>
<li>for image<a href="machupicchu.jpg">Click here</a></li>
</ul>
<li><h3>Christ The Redeemer</h3></li>
<ul>
<li><h4><p>located in Rio De Janerio,<i>BRAZIL</i></p></h4></li>
<li>for image<a href="christredeemer.jpg">Click here</a></li>
</ul>
</font>
</ol>
</body>
</html>
OUTPUT:
4
WPSLAB
PROGRAM:4 LINKS
<html>
<head>
<title>LINKS </title>
</head>
<body>
<h1 align="center">Links</h1>
<ol>
<li><h2>Linking other html documents</h2></li>
<ul>
<li><a href="sample.html">Basic tags</a></li>
<li><a href="images.html">Displaying images</a></li>
</ul>
<li><h2>Linking images</h2></li>
<a href="sample.html">
<img src="petra.jpg" width=100 height=100>Petra</a><br/>
<a href="images.html">
<img src="Taj.jpg" width=100 height=100>TAJ</a>
</ol>
</body>
</html>
OUTPUT:
5
WPSLAB
<html>
<head>
<title>Images</title>
</head>
<body>
<h2 align="center"><i>Displaying images</i></h2>
<h3>1.TAJ</h3><center>
<img src="Taj.jpg" width=500 height=250></center>
<h3>2.Machupichu</h3><center>
<img src="machupicchu.jpg" width=500 height=250></center>
</body>
</html>
OUTPUT:
6
WPSLAB
7
WPSLAB
OUTPUT:
8
WPSLAB
cellspacing=15>
<tr> <td> BRANCH </td>
<td> ROLL NO </td>
</tr>
<tr> <td> CSE </td>
<td> 8063</td>
</tr>
<tr>
<td> ECE </td>
<td>4012 </td>
</tr>
</table>
</td>
<td> DEPARTMENTS AND ROLLNO.s OF STUDENTS </td>
</tr>
</table>
</html>
OUTPUT:
9
WPSLAB
10
WPSLAB
PROGRAM:8 FORMS
<html>
<head><title>Form</title>
</head>
<body>
<table border=0 width=100% cellspacing=5 cellpadding=10>
<tr>
<td>
<table border=0 cellspacing=5 cellpadding=10>
<tr>
<td><u><b>YAHOO!</b></u></td>
</tr>
<tr>
<td>Username</td><td><input type=text name=Username></td>
</tr>
<tr>
<td>Password</td><td><input type=password ></td>
</tr>
<tr>
<td><input type=checkbox >
Remember password ?</td>
</tr>
<tr>
<td><input type=button name=login value=LOGIN>
<input type=button name=cancel value=cancel ></td>
</tr>
</table>
</td>
<td>
<table border=0 cellspacing=5 cellpadding=10>
<tr>
<td><b><u>GOOGLE</u></b></td>
</tr>
<tr>
<td>Username</td><td><input type=text name=Username></td>
</tr>
<tr>
<td>Password</td><td><input type=password ></td>
</tr>
11
WPSLAB
<tr>
<td><input type=checkbox >
Remember password ?</td>
</tr>
<tr>
<td><input type=button name=login value=LOGIN>
<input type=button name=cancel value=cancel ></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
OUTPUT:
12
WPSLAB
<html>
<head><title>Arithmetic operations</title>
<script type=text/javascript>
function addition(a,b)
{
var a,b,c;
a=parseInt(document.fm.fa.value);
b=parseInt(document.fm.fb.value);
c=a+b;
document.fm.fc.value=c;
}
function subtraction(a,b)
{
var a,b,c;
a=parseInt(document.fm.fa.value);
b=parseInt(document.fm.fb.value);
c=a-b;
document.fm.fc.value=c;
}
function multiplication(a,b)
{
var a,b,c;
a=parseInt(document.fm.fa.value);
b=parseInt(document.fm.fb.value);
c=a*b;
document.fm.fc.value=c;
}
function division(a,b)
{
var a,b,c;
a=parseInt(document.fm.fa.value);
b=parseInt(document.fm.fb.value);
c=a/b;
document.fm.fc.value=c;
}
</script>
13
WPSLAB
</head>
<body>
<form name=fm>
<h3>a</h3>
<input type=text name=fa>
<h3>b</h3>
<input type=text name=fb><br/>
<h3>c</h3>
<input type=text name=fc><br/><br/>
<input type=button value=add onclick=addition()>
<input type=button value=sub onclick=subtraction()>
<input type=button value=mul onclick=multiplication()>
<input type=button value=div onclick=division()>
</form>
</body>
</html>
OUTPUT:
14
WPSLAB
15
WPSLAB
OUTPUT:
16
WPSLAB
<html>
<head>
<title>validation</title>
<script type="text/javascript" src="pswdcheck.js">
</script>
</head>
<body>
<h1>password check</h1>
<form id="passwordform" action=" ">
<p>enter password</p>
<input type="password" id="first">
<p>Verify password</p>
<input type="password" id="second"><br/>
<input type=reset value=reset>
<input type=button value=submit onclick=passwordcheck()>
</form>
<script type="text/javascript" src="regevent.js">
</script>
</body>
</html>
<!---pswd.js--- >
function passwordcheck()
{
var one=document.getElementById("first");
var two=document.getElementById("second");
if(one.value =="")
{
alert("You havenot enter the password\n"+"Please enter it");
one.focus();
return false;
}
17
WPSLAB
if(one.value!=two.value)
{
alert(" Passwords donot match\n"+"Enter both fields again");
one.focus();
one.select();
return false;
}
else
return true;
}
<!-----regevent.js- ->
document.getElmentById("second").onblur=passwordcheck();
document.getElementById("passwordform").onsubmit=passwordcheck();
OUTPUT:
18
WPSLAB
<html>
<head><title>Absolute positioning</title>
<style type="text/css">
.regtext{font-family:arial;font-size:30pt;width=600px;
position:absolute;top:125px;left:100px; }
.abstext{position:absolute;Top:10px;left:50px;
font-family:italic;letter-spacing:lem;font-size:36pt;
color:teal;width:400px;}
</style>
</head>
<body>
<div class="regtext">
Dynamic XHTML is not a markup language.It is a collection of technologies that allows
dynamic changes to documents described with XHTML.
<span class="abstext">
This is an example for ABSOLUTE positioning
</span>
</div>
</body>
</html>
OUTPUT:
19
WPSLAB
<html>
<head><title>Relative positioning</title></head>
<body style="font-family:times;font-size=24pt;">
<p>
This is an example for illustrating<span style="position:relative;Top:10px;
font-family:times;font-style:italic;font-size:24pt;
color:red;">
RELATIVE POSITIONING</span> of elements.
</p>
<body>
</html>
OUTPUT:
20
WPSLAB
<!----DHTMLcolor.html----->
<html>
<head><title>Dynamic colors</title>
<script type="text/javascript" src="dyncolors.js">
</script>
</head>
<body>
<p style="font-family:times;font-style:italic;font-size:24pt">
This small page illustrates dynamic setting of the foreground and background colors for a
document
</p>
<form action=" ">
<p>
<label>Background color
21
WPSLAB
function setColor(where,newColor)
{
if(where=="background")
document.body.style.backgroundColor=newColor;
else
document.body.style.color=newColor;
}
OUTPUT:
22
WPSLAB
23
WPSLAB
OUTPUT:
24
WPSLAB
<!DOCTYPE ORGANISATION [
<!ELEMENT ORGANISATION (EMPLOYEE+)>
<!ELEMENT EMPLOYEE (EMPID?,EMPNAME+,EMPDESIGNATION*)>
<!ELEMENT EMPID (#PCDATA) >
<!ELEMENT EMPNAME (#PCDATA)>
<!ELEMENT EMPDESIGNATION (#PCDATA)>
<!ATTLIST PLACE NAME CDATA #REQUIRED>
]>
<ORGANISATION>
<EMPLOYEE>
<EMPID>555</EMPID>
<EMPNAME>CLARK</EMPNAME>
<EMPDESIGNATION>SE</EMPDESIGNATION>
<PLACE NAME = "HYD" >AP</PLACE>
</EMPLOYEE>
<EMPLOYEE>
<EMPID>666</EMPID>
<EMPNAME>ROBBIN</EMPNAME>
<EMPDESIGNATION>TE</EMPDESIGNATION>
<PLACE NAME = "NEWYORK">US</PLACE>
</EMPLOYEE>
</ORGANISATION>
EXAMPLE2:
25
WPSLAB
<!----------Employee.dtd--- >
OUTPUT:
PROGRAM:15 XSLT
<!---xml document--->
26
WPSLAB
27
WPSLAB
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
OUTPUT:
<html>
<head><title> XML DOM</title>
28
WPSLAB
</head>
<body>
<script type="text/javascript">
function sublistinfo()
{
xmlDoc= new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("sublist.xml");
x=xmlDoc.getElementsByTagName("sub")[0];
document.writeln("SUBJECT DETAILS"+"<br/>");
document.writeln("TITLE:"+x.firstChild.childNodes[0].nodeValue+"<br/>");
document.writeln("REFERENCE:"+x.lastChild.childNodes[0].nodeValue);
document.writeln("<br/>"+"NEXT SUBJECT DETAILS "+"<br/>");
document.writeln("TITLE:"+x.nextSibling.firstChild.childNodes[0].nodeValue+"<br/>");
document.writeln("REFERENCE:"+x.nextSibling.lastChild.childNodes[0].nodeValue);
}
</script>
<form>
<input type="button" name=click value=click onclick="sublistinfo()">
</body>
</html>
<!---sublist.xml--->
<?xml version="1.0" ?>
<subjectlist>
<sub>
<title>WPS</title>
<reference>WEB programming by Sebesta</reference>
</sub>
<sub>
<title>OOSD</title>
<reference>UML user guide by GRADY BOOCH</reference>
</sub>
<sub>
<title>ALGORITHMS</title>
<reference>Computer algorithms by sahni</reference>
</sub>
<sub>
<title>PPL</title>
<reference>PPL by RaviSethi</reference>
29
WPSLAB
</sub>
</subjectlist>
OUTPUT:
30
WPSLAB
import java.sql.*;
public class CreateStudent
{
public static void main(String[] args)
{
Connection con = null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =DriverManager.getConnection("jdbc:odbc:STUDENTDB");
// Creating a database table
Statement stmt = con.createStatement();
int count = stmt.executeUpdate(
"CREATE TABLE Studenttable (STID INT, STUname VARCHAR(20))");
System.out.println("Table created.");
stmt.close();
con.close();
}
catch(IOException e)
{
System.out.println(e.toString());
}
catch(ClassNotFoundException e)
{
System.out.println("CLASS NOT FOUND");
}
}
}
OUTPUT:
31
WPSLAB
32
WPSLAB
import java.sql.*;
public class InsertRows
{
public static void main(String [] args)
{
Connection con = null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:STUDENTDB");
Statement sta = con.createStatement();
int count = 0;
int c ;
c= sta.executeUpdate("INSERT INTO Studenttable (STID, STUname) VALUES(1,'Aparna')");
count = count + c;
c = sta.executeUpdate("INSERT INTO Studenttable (STID, STUname) VALUES (2,'Anusha')");
count = count + c;
c = sta.executeUpdate("INSERT INTO Studenttable (STID, STUname) VALUES (3,'Anjali')");
count = count + c;
System.out.println("Number of rows inserted: "+count);
sta.close();
con.close();
}
catch(IOException e)
{
System.out.println(e.toString());
}
catch(ClassNotFoundException e)
{
System.out.println("CLASS NOT FOUND");
}
}
}
33
WPSLAB
OUTPUT:
34
WPSLAB
import java.sql.*;
import java.io.*;
35
WPSLAB
OUTPUT:
36
WPSLAB
import java.io.*;
import javax.servlet.*;
public class BasicServlet extends GenericServlet
{
public void service(ServletRequest req, ServletResponse res) throws ServletException,
IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<head><title>Basic servlet example</title></head>");
out.println("<body >");
out.println("<h1 align=center> K.APARNA</h1>");
out.println("<h2 align=center>02078063</h2>");
out.println("</body>");
out.println("</html>");
}
}
OUTPUT:
37
WPSLAB
<html>
<head><title>Form</title></head>
<body>
<form name="form1" method=post action="http://localhost:8080/servlets-
examples/servlet/FormExample">
<p>Studentname</p>
<input type=text name=N>
<p>Rollno</p>
<input type=text name=R>
<p>Branch</p>
<input type=text name=B>
<input type=submit value=submit>
<input type=reset value =reset>
</form>
<body>
</html>
<!-----FormExample.java---->
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
38
WPSLAB
out.println("Branch:"+c+"<br/>");
}
}
OUTPUT:
When all the fields are entered and submitted,the following HTML page displays
39