You are on page 1of 65

EXPERIMENT 1

AIM: Write HTML/Java scripts to display your CV in navigator.

Theory: HTML: Hypertext Markup Language (HTML) is the standard markup language for
creating web pages and web applications. With Cascading Style Sheets (CSS)
and JavaScript it forms a triad of cornerstone technologies for the World Wide Web.
Java Script: often abbreviated as JS, is a high-level, dynamic, weakly typed, object-
based, multi-paradigm,and interpreted programming language.
Alongside HTML and CSS, JavaScript is one of the three core technologies of World Wide
Webcontent production. It is used to make webpages interactive and provide online
programs, including video games.

Source Code:
Resume.html
<html>

<head>

<h1 align=center><u>RESUME</u></h1>

</head>

<body>

<h2><b><font color="black">ADITYA JAISWAL</font></B><BR></h2>

<pre><font color="black" size=5>

<i>Royal Paradise Hostel

DTC,

GREATER NOIDA-201306</i>
<I>PHONE NO:</I>7503052865

<i>EMAIL:</i><a href=" ">567adddi.jais@gmail.com</a>

</font></Pre>

<hr size= 10width=100% noshade>

<h2 align=center><u>CAREER OBJECTIVE </u></h2>

<font size=5> To work with a fast growing organisation, where I can learn, achieve
professional excellence and implement my technical skills.</font>

<br><br><br>

<hr size=10 width=100% noshade>

<h2 align=center><u>ACADEMIC BACKGROUND</u></h2>

<table border=7pt cellspacing=0 cellpadding=30 width=25% align=center>

<tr>

<th> YEAR </th>

<th> DEGREE</th>

<th> UNIVERSITY/BOARD </th>

<th> SCHOOL </th>

<th> PERCENTAGE </th>

</tr>

<tr>

<td align=left> 2015-2019 </td>

<td align=right> B.TECH(INFORMATION TECHNOLOGY) </td>

<td align=center> AKTU</td>

<td align=center> G L BAJAJ</td>

<td align=center>72%</td>

</tr>
<tr>

<td align=left> 2014</td>

<td align=right>12 th</td>

<td align=center> CBSE </td>

<td align=center>UDAI PRATAP PUBLIC SCHOOL </td>

<td align=center> 76% </td>

</tr>

<tr>

<td align=left> 2012</td>

<td align=right> 10 th</td>

<td align=center> CBSE </td>

<td align=left> SWAMI HARSEWANAND PUBLIC SCHOOL</td>

<td align=center> 10 CGPA</td>

</tr>

</table>

<hr size=10 width=100% noshade><br><br>

<h2 align=center><u>INDUSTRIAL CERTIFICATION</u></h2>

<font size=5>

<ul>

<li>IOS APP DEVELOPMENT

<li>ISO CERTIFIED-ANDROID APP DEVELOPMENT

<li>ISO CERTIFIED-CORE JAVA

</ul>

</font>

<hr size=10 width=100% noshade><br><br>


<h2 align=center><u>COMPUTER AWARENESS</u></h2>

<font size=5>

<ul>

<li>HTML & CSS

<li>C

<li>C++

<li>JAVA

</ul></font>

<hr size=10 width=100% noshade><br><br>

<h2 align=center><u>C0-CURRICULAR ACTIVITY</u></h2>

<font size=5>

<ul>

<li>Participated in MATHS OLYMPIAD

<li>Participated in SCIENCE OLYMPIAD

<li>Participated in INTER SCHOOL COMPETITION

<li>Participated in various DRAMAS & QUIZS COMPETITION

</ul>

</font>

<hr size=10 width=100% noshade><br><br>

<h2 align=center><u>EXTRA-CURRICULAR ACTIVITIES</u></h2>

<font size=5> <ul>

<li>Video editing

<li> Listening songs

<li>Reading newspapers

</ul></font>
<hr size=10 width=100% noshade><br><br>

<h2 align=center><u> PERSONAL DETAILS</u></h2>

<BR><BR>

<pre><FONT COLOR="black" SIZE=5>

NAME : ADITYA JAISWAL

D.O.B. : 23/10/1997

FATHER'S NAME : MR. TARUN KUMAR JAISWAL

MOTHER'S NAME : SMT. ANITA JAISWAL

CATEGORY : OBC

GENDER : MALE

MARITAL STATUS : SINGLE

NATIONALITY : INDIAN

PERMANENT ADDRESS: J 12/16,J1-B RAMKATORA,BAULIABAGH

DISTT :- VARANASI

STATE:- UTTAR PRADESH

</font>

<BR><BR>

<font color="red" size=5> I hereby declare that the above written particulars are true to the
best of my knowledge and belief.</font>

<font size=5> <br/>ADITYA JAISWAL

PLACE:-GREATER NOIDA</font>

</font></pre>

</body></html>

Output:
EXPERIMENT 2

AIM: Write HTML/Java scripts to display an Institute website/ Department Website /


Tutorial website for specific subject.

Theory: HTML : Hypertext Markup Language (HTML) is the standard markup


language for creating web pages and web applications.

Java Script: often abbreviated as JS, is a high-level, dynamic, weakly


typed, object-based, multi-paradigm, and interpreted programming language.
Alongside HTML and CSS, JavaScript is one of the three core technologies of World Wide
Webcontent production.

Source code:
Default.html
<html>
<head>
<title>MY HTML PAGE</title>
</head>
<body bgcolor=BROWN>
<h1><center><tt><font color=yellow>G L BAJAJ INSTITUTE OF TECHNOLOGY
& MANAGEMENT</font> </tt><center></h1>
<hr size=10 width=100% noshade>
<marquee behavior=alternate><font face='cooper' size=4
color=black>......FIND YOUR SPARK......</font></marquee>
<img src=c:\77.jpg>
<pre>
<a href=glbajaj.html><FONT COLOR='BLACK'>ABOUT GLBAJAJ</FONT></A><BR>
<a href=course.html><FONT COLOR='BLACK'>COURSES & FEE
STRUCTURE</FONT></a><br>
<a href=gallery.html><FONT COLOR='BLACK'>GALLERY</FONT></a><br>
<a href=form.html><FONT COLOR='BLACK'>REGISTRATION</FONT></a><br>
<A href="mailto:gupta.kirti00@gmail.com">
<font color='purple'><FONT COLOR='BLACK'> FOR MORE INFORMATION CONTACT OUR
AUTHORITY</font></A>
<font face='cooper' size=5 color=black><a href=placement.html>OUR
PLACEMENT</a></font> <font size=3> Excellent Placement with highest selection
ratio.
Total companies visited- 153
Batch 2017 - 1080 placements
Highest package offered 25
Lacs</font>
<FONT face='cooper' size=5 color=black>OUR RECRUITERS</font>
<IMG src=c:\78.jpg> <IMG src=c:\79.jpg> <IMG src=c:\84.jpg>
<IMG src=c:\80.jpg> <IMG src=c:\81.jpg> <IMG src=c:\85.jpg>
<IMG src=c:\82.jpg> <IMG src=c:\83.jpg> <IMG src=c:\87.jpg>
</body>
</html>
ABOUT US :
Glbajaj.html
<html>
<head>
<title> glbajaj</title>
</head>
<body text=BLACK bgcolor=RED>
<font size=5>
<marquee behavior=alternate>........ABOUT GL BAJAJ......</MARQUEE><pre>
Overview
GL Bajaj Institute of Technology & Management is the 6th Institute established under
the prestigious banner of R.K Group. The institute is approved by All India Council for
Technical Education (AICTE), Ministry of HRD Govt. Of India and Affiliated to Dr. A.P.J.
Abdul Kalam Technical University (Formerly UPTU Lucknow).
In GL Bajaj, innovation is defined as the translation of knowledge and technologies in
the form of newer and better products and services. Being innovative adds value to our
graduates' education and training, which gives them the extra edge and ultimately
increases their employability. GL Bajaj strives to train and develop talented students and
budding professionals with intense focus on Technological development and career
grooming.
At GL Bajaj, we nurture and develop:
A robust culture built on people with pioneering and dare to dream spirit, coupled with
the vision and ability to turn ideas into reality.
Best quality education and training to enable students to be exceptionally competent to
match global standards, and there by create competent professionals with strong value
orientation.
A perfect blend of academia and modern technology.
Unique teaching and learning concepts relevant to the real world environment
Communication skills and Leadership skills.
An Integration of knowledge and talents throughout the curriculum.
Commitment to quality and continuous improvement.
Understanding of the societal, economic and environmental impacts of Technological
and managerial decisions. Cutting edge Technical Education and valuable expertise for
meeting the global challenges.
The teaching and learning environment at GL Bajaj makes technology and management
education more attractive to both students and faculty, as they are given the
opportunity to stay up-to-date. In today's world and in the future, Technological and
management education programs at GL Bajaj does not only teach the fundamentals of
technological and management theory, experimentation and practice, but also provides
a wide spectrum of corporate trends.
GL Bajaj actively encourages its faculty members to participate in research, educational
and leadership activities beyond the Technological and management college. The
college core faculty has good numbers of publications in national platform. In order to
make our faculty abreast of their discipline we promote Faculty Development Program
(FDP) - Wipro 10* which is one of the such program.
GL Bajaj actively encourages students to participate in university-wide activities. These
activities include participation in, student professional societies, athletics, performing
arts, debate, and similar activities. The AIM is to promote leadership and
communications skills as well as a sense of the integration of Technological and
management into the broader world.
We have opened student’s chapter of IEEE, Society of Automobile Engineering (SAE),
Business English Certificate (BEC), a course offered by Cambridge University, Indian
Scientific Technical Education (ISTE) . The college provides the best opportunities in
specialized technical education and Research &Development, which is focused, and co-
ordinate with prime attention to the various aspects of Technical skill building and
personality development.
We has established our own Research and Development center where in our faculty
continuously contribute their novel ideas, work and studies in different field of
Engineering at national and International levels.
As a part of commitment towards quality technical education and excellence, G L Bajaj
has embarked on promoting National and International Conferences, Seminars and
Symposium, which culminates into major interface with industry which play a
comprehensive role in the overall grooming of our students.
The policy statements and action items developed in G L Bajaj are intended to help
technological and management education to become RELEVANT, ATTRACTIVE and
CONNECTED well into the next century.
<A href=html.html>BACK TO HOME</a>
</pre>
</font>
</body>
</html>
COURSES & FEES STRUCTURE :

Course.html
<html>
<head>
<title>COURSES OFFERED</Title>
</head>
<body BGCOLOR=orange>
<marquee behavior=alternate>......COURSES NAME......</marquee><BR><br>
<marquee behavior=alternate>......DURATION......</marquee><br><br>
<marquee behavior=alternate>......FEES......</marquee><br><br>
<table border=7pt cellspacing=20 cellpadding=30 width=25% align=center>
<tr>
<th> COURSES NAME </th>
<th> DURATION </th>
<th> FEES (In Lacs) </th>
</tr>
<tr>
<td align=left> B Tech </td>
<td align=right> 4 Yrs </td>
<td align=center> 5 </td>
</tr>
<tr>
<td align=left> MCA</td>
<td align=right>2 Yrs.</td>
<td align=center> 6 </td>
</tr>
<tr>
<td align=left> MBA</td>
<td align=right>2 Yrs.</td>
<td align=center> 6 </td>
</tr>
<tr>
<td align=left> PGDM</td>
<td align=right>2 Yrs.</td>
<td align=center> 6 </td>
</tr>
</table>
<br><br><br>
<a href=html.html>BACK TO HOME</a>
</body>
</html>
GALLERY :

Gallery.html
<html>
<head>
<title>gallery of gl bajaj</title>
</head>
<body>
<pre>
<img src=c:\11.jpg><br><br>
<img src=c:\12.jpg> <img src=c:\13.jpg><br><br>
<img src=c:\14.jpg> <img src=c:\15.jpg><br>
<img src=c:\16.jpg>
<a href=html.html>BACK TO HOME</A>
</pre>
</body>
</html>

REGISTRATION :

Registeration.html
<html>
<head><title>forms</title></head>
<body BGCOLOR=ORANGE>
<forms method=get action="http:\\www.nielit.in/abc.jsp">
enter your name:<input type=text name=fnm size=20><br>
enter your age:<input type=text name=ag size=3><br>
password:<input type=password name=pw size=12><br>
Sex :<br>
<input type = radio name=s> Male <input type = radio name=s> Female<br>
<input type = checkbox name =ms >Interested in Music <br>
Address:
<br> <textarea name =ad rows=5 cols=20> Write your address here </textarea><br>
State : <select>
<option>Bihar</option>
<option>Odisa</option>
<option>UP</option>
<option>West Bengal</option>
</select>
<br><br><br>

<input type = submit value =Send> <input type=Refresh value=Clear><BR>


<a href=html.html>BACK TO HOME</a>
</body>

</html>

Output:
EXPERIMENT 3

AIM: Design HTML form for keeping student record and validate it using Java script. Also
apply External CSS.

Theory: It is important to validate the form submitted by the user because it can have
inappropriate values. So validation is must. The JavaScript provides you the facility the
validate the form on the client side so processing will be fast than server-side validation.
So, most of the web developers prefer JavaScript form validation We are applying
JavaScript to html code and using external css to provide styling effects.

Source code:
Form.html
<html><head>
<title>JavaScript Form Validation using a sample registration form</title>
<link rel='stylesheet' href='exp3.css' type='text/css' />
<script type = "text/javaScript">
function formValidation() {
var uid = document.registration.userid;
var passid = document.registration.passid;
var uname = document.registration.username;
var uadd = document.registration.address;
var ucountry = document.registration.country;
var uzip = document.registration.zip;
var uemail = document.registration.email;
var umsex = document.registration.msex;
var ufsex = document.registration.fsex;if(userid_validation(uid,5,12))
{
if(passid_validation(passid,7,12))
{ if(allLetter(uname))
{ if(alphanumeric(uadd))
{ if(countryselect(ucountry))
{ if(allnumeric(uzip))
{ if(ValidateEmail(uemail))
{ if(validsex(umsex,ufsex))
{ alert("enter again")
} } } } } } } }
return false;
} function userid_validation(uid,mx,my)
{
var uid_len = uid.value.length;
if (uid_len == 0 || uid_len >= my || uid_len < mx)
{ alert("User Id should not be empty / length be between "+mx+" to "+my);
uid.focus();
return false;
}
return true;
} function passid_validation(passid,mx,my)
{
var passid_len = passid.value.length;
if (passid_len == 0 ||passid_len >= my || passid_len < mx)
{
alert("Password should not be empty / length be between "+mx+" to "+my);
passid.focus();
return false;
} return true;
} function allLetter(uname)
{ var letters = /^[A-Za-z]+$/;
if(uname.value.match(letters))
{ return true; } else
{
alert('Username must have alphabet characters only');
uname.focus();
return false; } }
function alphanumeric(uadd) {
var letters = /^[0-9a-zA-Z]+$/;
if(uadd.value.match(letters))
{ return true;
}
else
{
alert('User address must have alphanumeric characters only');
uadd.focus();
return false; } }
function countryselect(ucountry)
{
if(ucountry.value == "Default")
{
alert('Select your country from the list');
ucountry.focus();
return false; } else {
return true; } }
function allnumeric(uzip)
{
var numbers = /^[0-9]+$/;
if(uzip.value.match(numbers))
{ return true;
} else {
alert('ZIP code must have numeric characters only');
uzip.focus();
return false;
} }
function ValidateEmail(uemail) {
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(uemail.value.match(mailformat)) {
return true; } else
{ alert("You have entered an invalid email address!");
uemail.focus();
return false;
} } function validsex(umsex,ufsex)
{
x=0;
if(umsex.checked)
{
x++;
} if(ufsex.checked)
{ x++;
}
if(x==0)
{ alert('Select Male/Female');
umsex.focus();
return false;
} else { alert('Form Succesfully Submitted');
window.location.reload()
return true; } }
</script>
</head>
<body>
<h1>Registration Form</h1>
<p>Use tab keys to move from one input field to the next.</p>
<form name='registration' onSubmit="return formValidation();">
<ul>
<li><label for="userid">User id:</label>
<input type="text" name="userid" size="12" /></li>
<li><label for="passid">Password:</label>
<input type="password" name="passid" size="12" /></li>
<li><label for="username">Name:</label>
<input type="text" name="username" size="50" /></li>
<li><label for="address">Address:</label>
<input type="text" name="address" size="50" /></li>
<li><label for="country">Country:</label>
<select name="country">
<option selected="" value="Default">(Please select a country)</option>
<option value="AF">Australia</option> <option value="AL">Canada</option>
<option value="DZ">India</option>
<option value="AS">Russia</option>
<option value="AD">USA</option>
</select></li>
<li><label for="zip">ZIP Code:</label>
<input type="text" name="zip" /></li>
<li><label for="email">Email:</label>
<input type="text" name="email" size="50" /></li>
<li><label id="gender">Sex:</label><ul type="square">
<li><input type="radio" name="msex" value="Male" /><span>Male</span></li>
<li><input type="radio" name="fsex" value="Female"
/><span>Female</span></li></ul></li>
</ul>
<input type="submit" name="submit" value="Submit" />
</form> </body> </html>

Output:
EXPERIMENT 4

AIM: Write an HTML program to design an entry form of student details and send it to
store at database server like SQL, Oracle or MS Access.

Theory: HTML Forms are required, when you want to collect some data from the site
Through jdbc support and java script we can connect html forms to database.

Source code:
Html file: form.html
<html>
<body>
<h1>Registration Form</h1>
<p>Use tab keys to move from one input field to the next. </p>
<form method="post"action="http://localhost:8080/examples/jsp/insertdata.jsp">
<ul>
<li><label for="userid">User id:</label>
<input type="text" name="userid" size="12" /></li>
<li><label for="passid">Password:</label>
<input type="password" name="passid" size="12" /></li>
<li><label for="username">Name:</label>
<input type="text" name="username" size="50" /></li>
<li><label for="address">Address:</label>
<input type="text" name="address" size="50" /></li>
<li><label for="email">Email:</label>
<input type="text" name="email" size="50" /></li>
<input type="submit" name="submit" value="Submit" />
</form> </body> </html>
JavaScript file: InsertData.jsp
<%@page import="java.sql. *"%>
<% String name=request.getParameter("name");
String address=request.getParameter("address");
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
Statement st=con.createStatement();
int i=st.executeUpdate("insert into data(userid, password, name, address, email)
values('"+userid+"','"+password+"','"++"','"+name+"','"+address+"')");
con.close();
out.println("Data is successfully inserted into database.");
}catch(Exception e){
System.out.println(e);
} %>

Output:
EXPERIMENT 5

AIM: Write programs using Java script for Web Page to display browsers information.

Theory: A script is a small piece of program that can add interactivity to your
website. only JavaScript and associated frameworks are being used by most of the web
developers, VBScript is not even supported by various major browsers. We here in this
program fetch the browser information through JavaScript.

Source code:
Exp5.html
<html>
<head>
<title>Google map using Java script</title>
<script language=javascript>
function show()
{ document.write("Name "+navigator.appName+"<br>");
document.write("Version "+navigator.appVersion +"<br>");
document.write("Platform"+navigator.platform +"<br>");
document.write("User language"+navigator.userAgent +"<br>");
document.write("User Agent"+navigator.userAgent +"<br>");
}</script></head>
<body> <form id="form1">
<div>
<input id="Button1" type="button" value="Click me" onclick="show()" />
</div>
</form>
</body>
</html>

Output:
EXPERIMENT 6

AIM: Write a Java applet to display the Application Program screen i.e. calculator and
other.

Theory: Applet is a special type of program that is embedded in the webpage to


generate the dynamic content. It runs inside the browser and works at client side. In this
program we are designing an Application program Screen with the help of java applet
and html.

Source code:
Java file :Cal.java
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Cal extends Applet
implements ActionListener
{ String msg=" ";
int v1,v2,result;
TextField t1;
Button b[]=new Button[10];
Button add,sub,mul,div,clear,mod,EQ;
char OP;
public void init()
{ Color k=new Color(120,89,90);
setBackground(k);
t1=new TextField(10);
GridLayout gl=new GridLayout(4,5);
setLayout(gl);
for(int i=0;i<10;i++)
{
b[i]=new Button(""+i);
}
add=new Button("add");
sub=new Button("sub");
mul=new Button("mul");
div=new Button("div");
mod=new Button("mod");
clear=new Button("clear");
EQ=new Button("EQ");
t1.addActionListener(this);
add(t1);
for(int i=0;i<10;i++)
{
add(b[i]);
}
add(add);
add(sub);
add(mul);
add(div);
add(mod);
add(clear);
add(EQ);
for(int i=0;i<10;i++)
{
b[i].addActionListener(this);
}
add.addActionListener(this);
sub.addActionListener(this);
mul.addActionListener(this);
div.addActionListener(this);
mod.addActionListener(this);
clear.addActionListener(this);
EQ.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String str=ae.getActionCommand();
char ch=str.charAt(0);
if ( Character.isDigit(ch))
t1.setText(t1.getText()+str);
else
if(str.equals("add"))
{
v1=Integer.parseInt(t1.getText());
OP='+';
t1.setText("");
}
else if(str.equals("sub"))
{
v1=Integer.parseInt(t1.getText());
OP='-';
t1.setText("");
}
else if(str.equals("mul"))
{
v1=Integer.parseInt(t1.getText());
OP='*';
t1.setText("");
}
else if(str.equals("div"))
{
v1=Integer.parseInt(t1.getText());
OP='/';
t1.setText("");
}
else if(str.equals("mod"))
{
v1=Integer.parseInt(t1.getText());
OP='%';
t1.setText("");
}
if(str.equals("EQ"))
{
v2=Integer.parseInt(t1.getText());
if(OP=='+')
result=v1+v2;
else if(OP=='-')
result=v1-v2;
else if(OP=='*')
result=v1*v2;
else if(OP=='/')
result=v1/v2;
else if(OP=='%')
result=v1%v2;
t1.setText(""+result);
}
if(str.equals("clear"))
{
t1.setText("");
}
}

HTML FILE : Cal.html


<html>
<head>
<title>Calculator</title>
</head>
<body>
<p>Hello World Applet

<applet code="Cal.class" width=300 height=200>


</applet>
</body>
</html>
Output:
EXPERIMENT 7

AIM: Writing program in XML for creation of DTD, which specifies set of rules. Create a
style sheet in CSS/ XSL & display the document in internet explorer.

Theory: XML stands for eXtensible Markup Language. XML was designed to store and
transport data.XML was designed to be both human- and machine-readable. An XML
document with correct syntax is called "Well Formed".An XML document validated
against a DTD is both "Well Formed" and "Valid".

Source code:
Catalog.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="cd_catalog.css"?>
<!DOCTYPE note
[
<!ELEMENT catalog (cd,cd)>
<!ELEMENT cd (title,artist,country,company,price,year)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT artist (#PCDATA)>
<!ELEMENT country (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT year (#PCDATA)>
]>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
</CATALOG>
CSS file:cd_catalog.css
CATALOG
{
background-color: #ffffff;
width: 100%;
}
CD
{
display: block;
margin-bottom: 30pt;
margin-left: 0;
}
TITLE
{
color: #FF0000;
font-size: 20pt;
}
ARTIST
{
color: #0000FF;
font-size: 20pt;
}
COUNTRY,PRICE,YEAR,COMPANY
{
display: block;
color: #000000;
margin-left: 20pt;
}

Output:
EXPERIMENT 8

Aim: Using ASP/JSP for server side programming, ASP/JSP for user name and password
and to retrieve & match the value. It displays success and failure messages. ASP/JSP for
creating text file local drive, ASP/JSP for keeping the student record in database.

Theory: JavaServer Pages (JSP) is a technology that helps software developers create
dynamically generated web pages based on HTML, XML, or other document types.
Released in 1999 by Sun Microsystems, JSP is similar to PHP and ASP, but it uses the Java
programming language.To deploy and run JavaServer Pages, a compatible web server
with a servlet container, such as Apache Tomcat or Jetty, is required.

Source Code:
Singnuppage.jsp
<html >
<head>
<title>signuppage.jsp</title>
<style type="text/css">
.auto-style3 {
text-align: center;
background-color: #FFFFFF;
}
.auto-style5 {
text-align: center;
font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
color: #000000;
background-color: #FFFFFF;
}
.auto-style6 {
border-width: 0px;
background-color: #FFFFFF;
}
.auto-style8 {
text-align: center;
color: #FF0000;
background-color: #FFFFFF;
}
.auto-style9 {
text-align: right;
background-color: #FFFFFF;
}
.auto-style10 {
text-align: center;
color: rgb(17, 69, 119);
font-size: 50px;
}
.auto-style11 {
background-color: #FFFFFF;
}
</style>
<h1 class="auto-style10">
<img alt="" height="103" src="newimage/images%20(1).jpg" width="104" />SIGN
UP</h1>
</head>
<body bgcolor="#FFFFFF" >
<FORM METHOD=POST ACTION="signuppage2.jsp">
<table align="center" width="500" class="auto-style6">
<tr>
<td class="auto-style8"></td>
</tr>
<tr>
<td class="auto-style5">U<strong>username</strong></td>
</tr>
<tr>
<td class="auto-style3"></td>
</tr>
<tr>
<td class="auto-style3"><INPUT TYPE=TEXT id ="username" NAME="username"
SIZE=20></td>
</tr>
<tr>
<td class="auto-style3"><br />
</td>
</tr>
<tr>
<td class="auto-style5">P<strong>assword</strong></td>
</tr>
<tr>
<td class="auto-style3"></td>
</tr>
<tr>
<td class="auto-style3"><INPUT TYPE=password NAME="password" id="password" ><br
/>
<br />
</td></tr>
<tr>
<td class="auto-style8" style="height: 23px"> <%
if(request.getParameter("msg") != null)
{
if(request.getParameter("msg").equals("9"))
{
%>
user name or password incorrect
<%
}
}
%>
</td>
</tr>
<tr>
<td class="auto-style8" style="height: 23px"><%
if(request.getParameter("msg") != null)
{
if(request.getParameter("msg").equals("7"))
{
%>
kindly log in
<%
}
}
%><br />
</td>
</tr>
<tr>
<td class="auto-style9" style="height: 23px"><a href="forget.jsp">Forget
password?</a></td>
</tr>
<tr>
<td class="auto-style11" >
<button type="submit" value="submit" style="height:27px;
width:150px">sumbit</button> </td>
</tr>
</table>
</form></body>
</html>
Signup2.jsp
<%@ page language="java" session="true"%>
<%@ page import="java.math.*" %>
<%@ page contentType="text/html" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.* "%>
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.text.*" %>
<!DOCTYPE html >
<html >

<body bgcolor="silver">
<%
String user1 = request.getParameter("username");
String pass1 =request.getParameter("password");
Connection conn = null;
Class.forName("oracle.jdbc.driver.OracleDriver");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn =DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST=localhost)(PORT = 1521)))
(CONNECT_DATA = (SERVICE_NAME = XE)) )","gaurangi","office123");
Statement stmt=conn.createStatement();
PreparedStatement ps = conn.prepareStatement("select username,password
from information where username = '"+user1+"' and password = '"+pass1+"'");
ResultSet rs1 = ps.executeQuery();
if(rs1.next())
{
String user2 = rs1.getString("username");
String pass2 = rs1.getString("password");
session.setAttribute("name",user2);
response.sendRedirect(response.encodeRedirectURL("new.jsp")); }
else
{
response.sendRedirect(response.encodeRedirectURL("signuppage.jsp?msg=9")); }
%>
</body>
</html>
Output:
Experiment 9

Aim:Program to illustrate JDBC connectivity. Program for maintaining database by


sending queries. Design and implement a simple servlet book query with the help of
JDBC & SQL. Create MS Access Database, Create on ODBC link, Compile & execute JAVA.

Theory: Java Database Connectivity (JDBC) is an application programming interface (API)


for the programming language Java, which defines how a client may access a database.
It is Java based data access technology and used for Java database connectivity. It is part
of the Java Standard Edition platform, from Oracle Corporation. It provides methods to
query and update data in a database, and is oriented towards relational databases. A
JDBC-to-ODBC bridge enables connections to any ODBC-accessible data source in the
Java virtual machine (JVM) host environment.

Source Code:
First.jsp
<!DOCTYPE html>
<html>
<style type="text/css">
.auto-style1 {
text-align: center;
}
.auto-style3 {
font-family: Georgia, "Times New Roman", Times, serif;
}
.auto-style4 {
text-align: center;
font-family: "Cooper Black";
font-weight: bold;
color: #000000;
font-size: 60px;
}
.auto-style5 {
text-align: center;
font-size: x-large;
}
.auto-style6 {
text-align: right;
font-family: Georgia, "Times New Roman", Times, serif;
}
.auto-style7 {
color: #3D3B82;
}
.auto-style8 {
color: #000000;
}
.auto-style9 {
background-color: #FFFFFF;
}
</style>

<body bgcolor="white">
<div class="auto-style1">
<head>
<title>First page</title>
</div>
<h1 class="auto-style4">
<img alt="" height="103" src="newimage/images%20(1).jpg" width="104"><span
class="auto-style7">Create an account</span></h1>
<p class="auto-style5"><span class="auto-style3"><span class="auto-style8">Already
have one?</span></span><a href="signuppage.jsp">Sign up</a></p>

<FORM METHOD=POST ACTION="secondpage.jsp">


<table style="width:100%; "newimage/images(1).jpg" class="auto-style9">
<tr>
<td class="auto-style6"><strong>Name</strong></td>
<td class="auto-style1"><INPUT TYPE=TEXT NAME="name" SIZE=50></td>
</tr>
<tr>
<td class="auto-style6"><strong>Username</strong></td>
<td class="auto-style1"><INPUT TYPE=TEXT NAME="username" SIZE=50></td>
<tr>
<td class="auto-style6"><strong>Email-id</strong></td>
<td class="auto-style1"><INPUT TYPE=TEXT NAME="emailid" SIZE=50></td>
</tr>
<tr>
<td class="auto-style6"><strong>Password</strong></td>
<td class="auto-style1"><INPUT TYPE=password NAME="pass" SIZE=50></td>
</tr>
<tr>
<td class="auto-style6"><strong>Age</strong></td>
<td class="auto-style1"><INPUT TYPE=NUMBER NAME="age" SIZE=50></td>
</tr>
<tr>
<br><td class="auto-style6"><p class="auto-style6"><strong>gender</strong></p></td>
<td class="auto-style1"><input type="radio" name="gender" value="male"checked >
Male<br>
&nbsp;&nbsp;&nbsp;
<input type="radio" name="gender" value="female" >&nbsp; Female</td>
</tr>
<tr>
<td class="auto-style6"><strong>Address</strong></td>
<td class="auto-style1"><INPUT TYPE=TEXT NAME="address" SIZE=50></td></tr>
<tr>
<td class="auto-style6"><strong>City</strong></td>
<td class="auto-style1"><INPUT TYPE=TEXT NAME="city" SIZE=50></td>
</tr>
<tr>
<td class="auto-style6"><strong>Country</strong></td>
<td class="auto-style1"><INPUT TYPE=TEXT NAME="country" SIZE=50></td>
</tr>
<tr>
<td class="auto-style6"><strong>Profession</strong></td>
<td class="auto-style1"><INPUT TYPE=TEXT NAME="profession" SIZE=50></td>
</tr>
<tr>
<td class="auto-style6"><strong>Company</strong></td>
<td class="auto-style1"><INPUT TYPE=TEXT NAME="company" SIZE=50></td>
</tr>
<tr>
<td class="auto-style6"><strong>Phone</strong></td>
<td class="auto-style1"><INPUT TYPE=TEXT NAME="phonenumber" SIZE=50></td>
</tr>
<tr>
<td class="auto-style6"><strong>Zip-code</strong></td>
<td class="auto-style1"><INPUT TYPE=number NAME="zipcode" SIZE=50></td>
</tr></table>
<div class="auto-style1">
<br><br><button type="SUMBIT" style="width: 81px; height: 21px">login</button>
</div>
</body>
</html>

Secondpage.jsp

<%@ page language="java" session="true"%>


<%@ page import="java.math.*" %>
<%@ page contentType="text/html" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.* "%>
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.text.*" %>

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.auto-style1 {
text-align: left;
}
</style>
</head>
<body>
<%
String name1 = request.getParameter("name");
String user1 =request.getParameter("username");
String email1 = request.getParameter("emailid");
String pass1 =request.getParameter("pass");
String repass1 = request.getParameter("repass");
String age1 =request.getParameter("age");
String gender1 = request.getParameter("gender");
String address1 =request.getParameter("address");
String city1 = request.getParameter("city");
String country1 =request.getParameter("country");
String profession1 = request.getParameter("profession");
String company1 =request.getParameter("company");
String phonenumber1 = request.getParameter("phonenumber");
String zipcode1 =request.getParameter("zipcode");
Connection conn = null;
Class.forName("oracle.jdbc.driver.OracleDriver");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn =DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST=localhost)(PORT = 1522)))
(CONNECT_DATA = (SERVICE_NAME = XE)) )","gaurangi","office123");
Statement stmt=conn.createStatement();
String pstmt = "select
name,username,email_id,password,retype_password,age,gender,address,city,country,p
rofession,company,phone,zip_code from information where name = '"+name1+"' and
username = '"+user1+"' and emailid = '"+email1+"' and pass = '"+pass1+"' and repass =
'"+repass1+"' and age = '"+age1+"' and gender = '"+gender1+"' and address =
'"+address1+"' and city = '"+city1+"' and country = '"+country1+"' and profession =
'"+profession1+"' and company = '"+company1+"' and phone = '"+phonenumber1+"'
and zip_code = '"+zipcode1+"'";
PreparedStatement ps = conn.prepareStatement("select
name,username,email_id,password,retype_password,age,gender,address,city,country,p
rofession,company,phone,zip_code from information where name = '"+name1+"' and
username = '"+user1+"' and email_id = '"+email1+"' and password = '"+pass1+"' and
retype_password = '"+repass1+"' and age = '"+age1+"' and gender = '"+gender1+"' and
address = '"+address1+"' and city = '"+city1+"' and country = '"+country1+"' and
profession = '"+profession1+"' and company = '"+company1+"' and phone =
'"+phonenumber1+"' and zip_code = '"+zipcode1+"'");
ResultSet rs1 = ps.executeQuery();
if(rs1.next()){
String name2 = rs1.getString("name");
String user2 =rs1.getString("username");
String email2 =rs1.getString("email_id");
String pass2 =rs1.getString("password");
String repass2 =rs1.getString("retype_password");
String age2 =rs1.getString("age");
String gender2 =rs1.getString("gender");
String address2 =rs1.getString("address");
String city2 =rs1.getString("city");
String country2 =rs1.getString("country");
String profession2 =rs1.getString("profession");
String company2 =rs1.getString("company");
String phonenumber2 =rs1.getString("phone");
String zipcode2 =rs1.getString("zip_code");
response.sendRedirect(response.encodeRedirectURL("home.jsp?msg=1"));
}
else
{
String query1 = "insert into
information(name,username,email_id,password,retype_password,age,gender,address,c
ity,country,profession,company,phone,zip_code)
values('"+name1+"','"+user1+"','"+email1+"','"+pass1+"','"+repass1+"','"+age1+"','"+gen
der1+"','"+address1+"','"+city1+"','"+country1+"','"+profession1+"','"+company1+"','"+p
honenumber1+"','"+zipcode1+"')";
stmt.executeUpdate(query1);
response.sendRedirect(response.encodeRedirectURL("home.jsp?msg=2"));
}
%>
</body>
</html>

Output:
EXPERIMENT 11

Aim: Write a Source Code to show Multithreading in JAVA.

Theory: Multithreading in java is a process of executing multiple threads


simultaneously.Thread is basically a lightweight sub-process, a smallest unit of
processing. Multiprocessing and multithreading, both are used to achieve multitasking.
But we use multithreading than multiprocessing because threads share a common
memory area. They don't allocate separate memory area so saves memory, and context-
switching between the threads takes less time than process. Java Multithreading is
mostly used in games, animation etc.

Source Code:

Runnable.java
class RunnableDemo implements Runnable {
private Thread t;
private String threadName;

RunnableDemo( String name) {


threadName = name;
System.out.println("Creating " + threadName );
}

public void run() {


System.out.println("Running " + threadName );
try {
for(int i = 4; i > 0; i--) {
System.out.println("Thread: " + threadName + ", " + i);
// Let the thread sleep for a while.
Thread.sleep(50);
}
} catch (InterruptedException e) {
System.out.println("Thread " + threadName + " interrupted.");
}
System.out.println("Thread " + threadName + " exiting.");
}

public void start () {


System.out.println("Starting " + threadName );
if (t == null) {
t = new Thread (this, threadName);
t.start ();
}
}
}

public class TestThread {

public static void main(String args[]) {


RunnableDemo R1 = new RunnableDemo( "Thread-1");
R1.start();

RunnableDemo R2 = new RunnableDemo( "Thread-2");


R2.start();
}
}
Output:
EXPERIMENT 12

Aim: Write a Program in JAVA to copy contents of one file into another file.

Theory: Java is a set of computer software and specifications developed by Sun


Microsystems, which was later acquired by the Oracle Corporation, that provides a
system for developing application software and deploying it in a cross-platform
computing environment. Java is used in a wide variety of computing platforms from
embedded devices and mobile phones to enterprise servers and supercomputers. Java
applets, which are less common than standalone Java applications, run in secure,
sandboxed environments to provide many features of native applications and can be
embedded in HTML pages.

Source Code:
Copyfiletofile.java
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyFiletoFile


{
public static void main(String[] args)
{
FileInputStream instream = null;
FileOutputStream outstream = null;

try{
File infile =new File("F:\\WT lab final\\program no. (12)\\MyInputFile.txt");
File outfile =new File("F:\\WT lab final\\program no. (12)\\MyOutputFile.txt");

instream = new FileInputStream(infile);


outstream = new FileOutputStream(outfile);

byte[] buffer = new byte[1024];

int length;
/*copying the contents from input stream to
* output stream using read and write methods
*/
while ((length = instream.read(buffer)) > 0){
outstream.write(buffer, 0, length);
}

//Closing the input/output file streams


instream.close();
outstream.close();

System.out.println("File copied successfully!!");

}catch(IOException ioe){
ioe.printStackTrace();
}
}
}
Output:
EXPERIMENT 13

Aim: Create an AWT with a text field and three buttons. When you press each button,
make some different text appear in the text field.

Theory: Java AWT (Abstract Window Toolkit) is an API to develop GUI or window-based
applications in java.Java AWT components are platform-dependent i.e. components are
displayed according to the view of operating system. AWT is heavyweight i.e. its
components are using the resources of OS.The java.awt package provides classes for
AWT api such as TextField, Label, TextArea, RadioButton, CheckBox, Choice, List etc.

Source Code:
import java.awt.*;

import java.awt.event.*;

import java.applet.*;

/*<applet code="three" width=500 height=500></applet>*/

public class Three extends Applet implements ActionListener,ItemListener

Button b1,b2,b3;

Checkbox cb;

TextField tf;

public void init()

{
tf=new TextField("Checked",10);

b1=new Button("file");

b2=new Button("Open");

b3=new Button("Save");

setLayout(new FlowLayout());

add(b1);

add(b2);

add(b3);

add(tf);

b1.addActionListener(this);

b2.addActionListener(this);

b3.addActionListener(this);

tf.addActionListener(this);

setBackground(Color.WHITE);

public void actionPerformed(ActionEvent ae)

String s;

s=ae.getActionCommand();

if(s.equals("file"))
tf.setText("file");

else if(s.equals("Open"))

tf.setText("open");

else if(s.equals("Save"))

tf.setText("save");

public void itemStateChanged(ItemEvent ae)

if(cb.getState())

tf.setText("checked");

else

tf.setText("unchecked");

}
Output:
EXPERIMENT 14

Aim: Develop a servlet that gets invoked when a form on a webpage in HTML is
submitted .

Theory: Servlet can be described in many ways, depending on the context. Servlet is a
technology i.e. used to create web application. Servlet is an API that provides many
interfaces and classes including documentations. Servlet is an interface that must be
implemented for creating any servlet. Servlet is a class that extend the capabilities of
the servers and respond to the incoming request. It can respond to any type of requests.
Servlet is a web component that is deployed on the server to create dynamic web page.

Source Code:
import javax.servlet.*;

import java.io.*;

public class Add implements Servlet{

public void init(ServletConfig sc){}

public void service(ServletRequest sreq,ServletResponse sres){

PrintWriter out=null;

try{

String s1=sreq.getParameter("num1");

String s2=sreq.getParameter("num2");

int n1=Integer.parseInt(s1);
int n2=Integer.parseInt(s2);

int n=n1+n2;

sres.setContentType("text/html");

out=sres.getWriter();

out.println("<html><boby>");

out.println("<h1>My First Web Application</h1>");

out.println("Addition of <b>"+n1+"</b> and <b>"+n+"</b> = <b>"+n+"</b>");

out.println("</boby></html>");

catch(Exception ex)

out.println(ex);

public void destroy(){}

public ServletConfig getServletConfig(){

return null;

public String getServletInfo(){

return null;
}

Output:
EXPERIMENT 15

Aim: Write a PHP Script to create a student registration form containing rollno, name,
address, contact read the data from the form and store the data into the database.

Theory: PHP is a server-side scripting language designed primarily for web development
but also used as a general-purpose programming language. Originally created by
Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP
Development Team. PHP originally stood for Personal Home Page, but it now stands for
the recursive acronym PHP: Hypertext Preprocessor.

Source Code:
Login.php
<?php
$con = mysqli_connect("localhost","root","","eve_first");
?>
<form method="post" enctype="multipart/form-data">
name<input type="text" name="fname"><br><br>
email<input type="email" name="email"><br><br>
password<input type="password" name="pass"><br><br>
phn no<input type="number" name="cont"><br><br>
image<input type="file" name="profile"><br><br>
<input type="submit" name="sub">
</form>
<?php
if(isset($_POST['sub'])){
$fname = $_POST['fname'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$cont = $_POST['cont'];
$filename = $_FILES['profile']['name'];
$tmpname = $_FILES['profile']['tmp_name'];
move_uploaded_file($tmpname,"image/".$filename);
$query = mysqli_num_rows(mysqli_query($con,"select * from userss where
email='$email'"));
if($query==1){
echo "Already Registered";
}
else{
$q = mysqli_query($con,"insert into userss
(name,email,pass,cont,profilepic)values('$fname','$email','$pass','$cont','$filename')");
if($q){
echo "Registered Successfully";
}
}
}
?>
Output: