microsoft word - paavai
TRANSCRIPT
-
7/28/2019 Microsoft Word - PAAVAI
1/65
EX. NO: 1 TO CREATE A WEBPAGE USING HTML TAGS
DATE:
AIM:-
To design college web page using basic Html Tags
ALGORITHM:-
STEP 1: Start the process.
STEP 2: Create HTML files with required tags
STEP 3: Use frames to separate the window
STEP 4: Link the files using the anchor tag
STEP 5: Create Tables to organize the college information
STEP 6: Place the Image in the created website
STEP 7: Place the required data and fields in the created website
STEP 8: Stop the process.
1
-
7/28/2019 Microsoft Word - PAAVAI
2/65
PROGRAM:-
main.html
WeLcome to Paavai college of Engineering
row1.html
PAAVAI COLLEGE OF ENGINEERING
AFFLIATED TO ANNA UNIVERSITY, CHENNAI
column1.html
2
-
7/28/2019 Microsoft Word - PAAVAI
3/65
welcome to PAAVAI
UG COURSES
PG COURSES
LIBRARY FACILITIES
ABOUT US
aboutus.html
College started in 1998
Placed at Coimbatore
Internet facility and WIFI Campus
Hostel Facilities available for both gender
Placement -on campus and off campus
ugcourse.html
3
-
7/28/2019 Microsoft Word - PAAVAI
4/65
Our College have the following UG level courses
B.E(CSE)
B.TECH(IT)
B.E(MECH)
B.E(ECE)
B.TECH(TEXT)
B.E(EEE)
pgcourse.html
Our college have the following PG level COURSES
M.E(CSE)
M.E(Comm Sys)
MBA
MCA
library.html
4
-
7/28/2019 Microsoft Word - PAAVAI
5/65
Header 1
Header 2
1.Main library
It have many books for all department subjects No.of books=
50,000
2.digital library
Seperate Internet LAB Available
3.journals and paper section Library
No.of Jurnals :569,
No.of Projects:2000,
All tamil and English Newspapers are available
5
-
7/28/2019 Microsoft Word - PAAVAI
6/65
OUTPUT:
RESULT
The web page has been successfully designed and the output was
verified
6
-
7/28/2019 Microsoft Word - PAAVAI
7/65
Ex. No: 02 HTML WITH INTERNAL AND EXTERNAL CSS
DATE:
Aim:
To create a HTML page using internal and external CSS.
Algorithm:
1. Create a simple HTML page.
2. Write internal CSS using tag in the same page become internal
CSS.
3. Create another CSS file using tag with extension .css file, which
becomes external CSS file
4. Include the external CSS file in your file.
5. Find the style changes on your page.
7
-
7/28/2019 Microsoft Word - PAAVAI
8/65
Program:
int_ext_css.html
Internal CSS Example Page
{
font-family:"Times New Roman",Times,serif;
font-size:30px;
}
Anna University of Technology Chennai
An ISO 9001:2008 Certified Insitution
styl.css
head
{
}
body {
background-color:#d0e4fe;
}h1
{
color:orange;
text-align:center;
}
8
-
7/28/2019 Microsoft Word - PAAVAI
9/65
OUTPUT:
Result:
Thus the given program was coded and executed successfully.
9
-
7/28/2019 Microsoft Word - PAAVAI
10/65
Ex. No: 3.a DATE COMPARISION USING JAVA SCRIPT
DATE:
Aim:
To create a HTML page using java script to find difference between two
dates.
Algorithm:
1. Write a function using java script to set the date.
2. Write a function using java script to set the month.
3. Write a function using java script to find the difference between two
dates.
4. Write another function to display all the details in your page.
5. Use appropriate tags to display the content on your pages
10
-
7/28/2019 Microsoft Word - PAAVAI
11/65
PROGRAM
datediff.html
function writeOptions(startNumber, endNumber)
{
var optionCounter;
for (optionCounter = startNumber; optionCounter
-
7/28/2019 Microsoft Word - PAAVAI
12/65
myForm.firstDay.options[myForm.firstDay.selectedIndex].value;
var secondDay =
myForm.secondDay.options[myForm.secondDay.selectedIndex].value;
var firstMonth =
myForm.firstMonth.options[myForm.firstMonth.selectedIndex].value;
var secondMonth =
myForm.secondMonth.options[myForm.secondMonth.selectedIndex].value;
var firstYear =
myForm.firstYear.options[myForm.firstYear.selectedIndex].value;
var secondYear =
myForm.secondYear.options[myForm.secondYear.selectedIndex].value;
var firstDate = new Date(firstDay + " " + firstMonth + " " + firstYear);
var secondDate = new Date(secondDay + " " + secondMonth + " " +
secondYear);
var daysDiff = (secondDate.valueOf() - firstDate.valueOf());
daysDiff = Math.floor(Math.abs((((daysDiff / 1000) / 60) / 60) / 24));
myForm.txtDays.value = daysDiff;
var age=daysDiff/365;
myForm.age1.value=Math.floor(age);
return true;
}
function window_onload()
{
var theForm = document.form1;
var nowDate = new Date();
theForm.firstDay.options[nowDate.getDate() - 1].selected = true;theForm.secondDay.options[nowDate.getDate() - 1].selected = true;
theForm.firstMonth.options[nowDate.getMonth()].selected = true;
theForm.secondMonth.options[nowDate.getMonth()].selected = true;
theForm.firstYear.options[nowDate.getFullYear()- 1970].selected = true;
theForm.secondYear.options[nowDate.getFullYear() - 1970].selected = true;
12
-
7/28/2019 Microsoft Word - PAAVAI
13/65
}
Select your Date of Birth
writeOptions(1,31);
writeMonthOptions();
writeOptions(1970,2010);
Select End Date
writeOptions(1,31);
13
-
7/28/2019 Microsoft Word - PAAVAI
14/65
writeMonthOptions();
writeOptions(1970,2010);
Total difference in days:
Your Age is:
14
-
7/28/2019 Microsoft Word - PAAVAI
15/65
OUTPUT:
RESULT:
Thus the given program was coded and executed successfully.
15
-
7/28/2019 Microsoft Word - PAAVAI
16/65
Ex. No: 3.b FORM VALIDATION USING JAVA SCRIPT
DATE:
Aim:
To design a webpage to validate a form
Algorithm:
1. Design a page for signup form with rich user interface.
2. Write the java script function to validate all mandatory fields on your
web page.
3. Validation should be done after the submit operation.
4. Use appropriate tags to display the contents.
5. Make sure the page is working efficiently.
16
-
7/28/2019 Microsoft Word - PAAVAI
17/65
PROGRAM
signup.html
Student Registration Form
-
7/28/2019 Microsoft Word - PAAVAI
18/65
if(document.signup.pword1.value.length
-
7/28/2019 Microsoft Word - PAAVAI
19/65
}
-->
SMail
New User Signup Form
*First Name:
*Last Name:
*User Name:
@smail.com
*Password :
(min 6 characters)
*Confirm Password:
Gender :Male
Female
Country:
19
-
7/28/2019 Microsoft Word - PAAVAI
20/65
Select Country
India
Russia
France
Italy
Language Known:
Tamil
English
Hindi
Malayalayam
Alternate Email:
I agree the terms and conditions
20
-
7/28/2019 Microsoft Word - PAAVAI
21/65
OUTPUT:
RESULT:
Thus the given program was coded and executed successfully.
21
-
7/28/2019 Microsoft Word - PAAVAI
22/65
Ex.No:4 ONLINE BOOK SHOPPING USING JSP OBJECTS
DATE:
Aim:
To write an online book shopping application using JSP objects.
Algorithm:
1. Create home, login, registration, profile, catalog and order html pages.
2. Create a jsp page which does all business works on the server.
3. Use appropriate database to store the details of the books.
4. Create tables to store login details and books details.
5. Connect the database using odbc.jdbc driver.
6. Make changes in the control settings to enable database on your local
machine.
22
-
7/28/2019 Microsoft Word - PAAVAI
23/65
PROGRAM
Main.html:
>U>ONLINE BOOK STORAGE
Welcome to online book storage.
Press LOGIN if you are having id
Otherwise press REGISTRATION
LOGIN
href=/tr/login.html>REGISTRATION
Login.html:
-
7/28/2019 Microsoft Word - PAAVAI
24/65
Reg.html:
NAME :
ADDRESS :
CONTACT NUMBER :
LOGIN ID :
PASSWORD :
()">
Profile.html:
LOGIN ID :
24
-
7/28/2019 Microsoft Word - PAAVAI
25/65
()">
Catalog.html:
BOOK TITLE :
Order.html:
LOGIN ID :
PASSWORD :
TITLE :
NO. OF BOOKS :
DATE :
25
-
7/28/2019 Microsoft Word - PAAVAI
26/65
CREDIT CARD NUMBER :
Login.jsp:
%@page import=java.sql.*%
%@page import=java.io.*%
-
7/28/2019 Microsoft Word - PAAVAI
27/65
{
flag=1;
}
if(flag==0)
{
out.println(SORRY INVALID ID TRY AGAIN ID
);out.println( press LOGIN to
RETRY);
}
else
{
out.println(VALID LOGIN ID
);out.println();
out.println(USER
PROFILE
);out.println(BOOKS
CATALOG
);out.println(ORDER
CONFIRMATION
);out.println();
}
out.println();
%>
Reg.jsp:
%@page import=java.sql.*%%@page import=java.io.*%
-
7/28/2019 Microsoft Word - PAAVAI
28/65
String phno=request.getParameter(phno);
String id=request.getParameter(id);
String pwd=request.getParameter(pwd);
int no=Integer.parseInt(phno);
Driver d=new oracle.jdbc.driver.OracleDriver();
DriverManager.registerDriver(d);
Connection con=DriverManager.getConnection
(jdbc:oracle:thin:@localhost:1521:orcl,scott,tiger);
Statement stmt=con.createStatement();
String sqlstmt=select id from login;
ResultSet rs=stmt.executeQuery(sqlstmt);
int flag=0;
while(rs.next())
{
if(id.equals(rs.getString(1)))
{
flag=1;
}
}
if(flag==1)
{
out.println(SORRY LOGIN ID ALREADY EXISTS TRY AGAIN WITH NEW ID
);out.println(press REGISTER to RETRY);
}
else{
Statement stmt1=con.createStatement ();
stmt1.executeUpdate (insert into login values
(+name+,+addr+,+no+,+id+,+pwd+));
out.println (YOU DETAILS ARE ENTERED
);28
-
7/28/2019 Microsoft Word - PAAVAI
29/65
out.println (press LOGIN to login);
}
out.println ();
%>
Profile.jsp:
-
7/28/2019 Microsoft Word - PAAVAI
30/65
}
out.println ();
%>
Catalog.jsp:
-
7/28/2019 Microsoft Word - PAAVAI
31/65
out.println(press HERE to RETRY );
}
out.println ();
%>
Order.jsp:
-
7/28/2019 Microsoft Word - PAAVAI
32/65
if(flag==0)
{
out.println(SORRY INVALID ID TRY AGAIN ID
);out.println(press HERE to RETRY
);
}
else
{
Statement stmt2=con.createStatement();
String s=select cost from book where title=+title+;
ResultSet rs1=stmt2.executeQuery(s);
int flag1=0;
while(rs1.next())
{
flag1=1;
x=Integer.parseInt(rs1.getString(1));
amount=count*x;
out.println(AMOUNT :+amount+
);Statement stmt1=con.createStatement ();
stmt1.executeUpdate (insert into details
(+id+,+title+,+amount+,+date+,+cno+));
out.println (YOU ORDER HAS TAKEN
);}
if(flag1==0)
{
out.println(SORRY INVALID BOOK TRY AGAIN
);out.println(press HERE to RETRY);
}
} out.println ();%>
32
-
7/28/2019 Microsoft Word - PAAVAI
33/65
33
-
7/28/2019 Microsoft Word - PAAVAI
34/65
OUTPUT:
34
-
7/28/2019 Microsoft Word - PAAVAI
35/65
35
-
7/28/2019 Microsoft Word - PAAVAI
36/65
Result:
Thus the given program was coded and executed successfully.
36
-
7/28/2019 Microsoft Word - PAAVAI
37/65
Ex.No:5 SERVLET PROGRAM USING HTTP SERVLET
DATE:
AIM:
To create a servlet program and check the script validation.
ALGORITHM:
Step 1: Start the program.
Step 2: Get the context text at Servlet at text html.
Step 3: Get the response from the user by entering the username field.
Step 4: Get the response from the user by entering the password field.
Step 5: If the username and password are correct, then the user is
authenticated and can enter into web page.
Step 6: Execute the program in Internet Explorer.
Step 7: Stop the program
37
-
7/28/2019 Microsoft Word - PAAVAI
38/65
PROGRAM:
HTML Code
USERNAME AND PASSWORD>
USERNAME
PASSWORD
Java Servlet Code :
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class servlet1 extends HttpServlet{
public void doGet(HttpServletRequest req,HttpServletResponse res)throws
ServletException,IOException
{
res.setContentType("text/html");
38
-
7/28/2019 Microsoft Word - PAAVAI
39/65
PrintWriter pw=res.getWriter();
String admin=req.getParameter("username");
String pass=req.getParameter("password");
pw.println(admin);
pw.println(pass);
if((admin.equals("admin2010")) && (pass.equals("abc123")))
{
pw.println("Authorized user");
}
else
{
pw.println("not an Authorized user");
}
}
}
39
-
7/28/2019 Microsoft Word - PAAVAI
40/65
Output:
Result:
Thus the given program was coded and executed successfully.
40
-
7/28/2019 Microsoft Word - PAAVAI
41/65
Ex.No:06 ONLINE SHOPPING DATABASE APPLICATION
DATE:
Aim:
To create an online application using database access.
Algorithm:
1. Create an ASP page which get details from the user.
2. Create a database connection using ASP code.
3. Compare the details of the user with the database.
4. Get the amount from the user from payment gateway.
5. Deliver the products the user to his/her address.
41
-
7/28/2019 Microsoft Word - PAAVAI
42/65
PROGRAM
send.asp
New Page 1
XML Database
42
-
7/28/2019 Microsoft Word - PAAVAI
43/65
View1
View2
-
7/28/2019 Microsoft Word - PAAVAI
44/65
response.write XMLDom.transformNode(XSLDom)
%>
datasource.asp
44
-
7/28/2019 Microsoft Word - PAAVAI
45/65
View1.xsl
45
-
7/28/2019 Microsoft Word - PAAVAI
46/65
View2.xsl
46
-
7/28/2019 Microsoft Word - PAAVAI
47/65
Output:
Result:
Thus the given program was coded and executed successfully.
47
-
7/28/2019 Microsoft Word - PAAVAI
48/65
Ex.No:07 CREATION OF XML DOCUMENT FOR A SPECIFIC DOMAIN
DATE:
AIM:
To creation of XML document for a specific domain
ALGORITHM:
Step 1: start the program
Step 2: Using Onclick(),validate the student details as entered.
Step 3: In XML file,we use styles for structure the program as
#PCDATA(datafield)
Step 4: Using various HTML tags and attribute,we design the web page.
Step 5: Using various XML attribute list and entity list to retrieve the
information of student.
Step 6: Using processing instructions which we required to describe the data.
Step 7: Using note.xmlas xmlid to connect with html file.Execute the
program.
Step 8: Stop the program.
48
-
7/28/2019 Microsoft Word - PAAVAI
49/65
PROGRAM:
Student.html
function prev_onclick()
{
std.previousPage()
}
function next_onclick()
{
std.nextPage()
}
REGNONAMECOURSESEM
49
-
7/28/2019 Microsoft Word - PAAVAI
50/65
note.xml
0001
SURESH.V
M.E CSE
II
0002
DIVIYA
M.E CSE
II
50
-
7/28/2019 Microsoft Word - PAAVAI
51/65
OUTPUT:
Result:
Thus the given program was coded and executed successfully.
51
-
7/28/2019 Microsoft Word - PAAVAI
52/65
Ex.No:08 WRITING DTD OR XML SCHEMA FOR THE DOMAIN
DATE: SPECIFIC XML DOCUMENT
AIM:
To write a program for DTD and XML schema for the domain specific XML
document.
ALGORITHM:
Step1: Start the program
Step2: Open an XML file as Letter.xml, to create detail of person using
various xml attribute list
Step3: Using user defined tags, we can create details of person using
name, pincode, address, ph.no, etc..
Step4: Open DTD file as letter . dtd
Step5: Using an external and internaldtd,we create elementlist as
#PCDATA for retrieve the datafield
Step6: Using attribute declaration ,use to retrieve the datafield as more
than one time
Step7: Execute the program
52
-
7/28/2019 Microsoft Word - PAAVAI
53/65
PROGRAM:
Letter.xml
aaaa
dfdsgdsgdsfvg
chennai
tamilnadu
600089
044-23456789
bbbb
dfdsgdsgdsfvg
fvgefgffdg
chennai
tamilnadu
600089
044-23456789
Dear Sir:
It is our privillege .........
Sincerely
Ms.aaaaa
53
-
7/28/2019 Microsoft Word - PAAVAI
54/65
Letter.dtd
54
-
7/28/2019 Microsoft Word - PAAVAI
55/65
OUTPUT:
RESULT:
Thus the given program was coded and executed successfully.
55
-
7/28/2019 Microsoft Word - PAAVAI
56/65
Ex.No:09 PARSING AN XML DOCUMENT USING DOM AND SAX
DATE: PARSERS
AIM:
To Parsing an XML document using DOM and SAX Parsers.
ALGORITHM:
Using DOM:
Step 1: Get a document builder using document builder factory and parse
the xml file to create a DOM object
Step 2: Get a list of employee elements from the DOM
Step 3: For each employee element get the id, name, age and type. Create
an employee value object and add it to the list.
Step 4: At the end iterate through the list and print the employees to verify
we parsed it right.
Using SAX:
Step 1: Create a Sax parser and parse the xml
Step 2: In the event handler create the employee object
Step 3 : Print out the data
56
-
7/28/2019 Microsoft Word - PAAVAI
57/65
PROGRAM:
employees.xml
Seagull
3674
34
Robin
3675
25
Crow
3676
28
Using DOM
DomParserExample.java
a) Getting a document builderprivate void parseXmlFile(){
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
dom = db.parse("employees.xml");
57
-
7/28/2019 Microsoft Word - PAAVAI
58/65
}catch(ParserConfigurationException pce) {
pce.printStackTrace();
}catch(SAXException se) {
se.printStackTrace();
}catch(IOException ioe) {
ioe.printStackTrace();
}
}
b) Get a list of employee elements
Get the rootElement from the DOM object.From the root element get all
employee elements. Iterate through each employee element to load the data.
private void parseDocument(){
Element docEle = dom.getDocumentElement();
NodeList nl = docEle.getElementsByTagName("Employee");
if(nl != null && nl.getLength() > 0) {
for(int i = 0 ; i < nl.getLength();i++) {
Element el = (Element)nl.item(i);
Employee e = getEmployee(el);
myEmpls.add(e);
}
}
}
c) Reading in data from each employee.
private Employee getEmployee(Element empEl) {
String name = getTextValue(empEl,"Name");
int id = getIntValue(empEl,"Id");int age = getIntValue(empEl,"Age");
String type = empEl.getAttribute("type");
Employee e = new Employee(name,id,age,type);
return e;
}
58
-
7/28/2019 Microsoft Word - PAAVAI
59/65
private String getTextValue(Element ele, String tagName) {
String textVal = null;
NodeList nl = ele.getElementsByTagName(tagName);
if(nl != null && nl.getLength() > 0) {
Element el = (Element)nl.item(0);
textVal = el.getFirstChild().getNodeValue();
}
return textVal;
}
private int getIntValue(Element ele, String tagName) {
return Integer.parseInt(getTextValue(ele,tagName));
}
d) Iterating and printing.
private void printData(){
System.out.println("No of Employees '" + myEmpls.size() + "'.");
Iterator it = myEmpls.iterator();
while(it.hasNext()) {
System.out.println(it.next().toString());
}
}
Using Sax
SAXParserExample.java
a) Create a Sax Parser and parse the xml
private void parseDocument() {
SAXParserFactory spf = SAXParserFactory.newInstance();
try {
SAXParser sp = spf.newSAXParser();
59
-
7/28/2019 Microsoft Word - PAAVAI
60/65
sp.parse("employees.xml", this);
}catch(SAXException se) {
se.printStackTrace();
}catch(ParserConfigurationException pce) {
pce.printStackTrace();
}catch (IOException ie) {
ie.printStackTrace();
}
}
b) In the event handlers create the Employee object and call the
corresponding setter methods.
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
tempVal = "";
if(qName.equalsIgnoreCase("Employee")) {
tempEmp = new Employee();
tempEmp.setType(attributes.getValue("type"));
}
}
public void characters(char[] ch, int start, int length) throws SAXException {
tempVal = new String(ch,start,length);
60
-
7/28/2019 Microsoft Word - PAAVAI
61/65
}
public void endElement(String uri, String localName
String qName) throws SAXException {
if(qName.equalsIgnoreCase("Employee")) {
myEmpls.add(tempEmp);
}else if (qName.equalsIgnoreCase("Name")) {
tempEmp.setName(tempVal);
}else if (qName.equalsIgnoreCase("Id")) {
tempEmp.setId(Integer.parseInt(tempVal));
}else if (qName.equalsIgnoreCase("Age")) {
tempEmp.setAge(Integer.parseInt(tempVal));
}
}
c) Iterating and printing.
private void printData(){
System.out.println("No of Employees '" + myEmpls.size() + "'.");
terator it = myEmpls.iterator();
while(it.hasNext()) {
System.out.println(it.next().toString());
}
}
61
-
7/28/2019 Microsoft Word - PAAVAI
62/65
Output:
Employee Details - Name:Seagull, Type:permanent, Id:3674, Age:34
Employee Details - Name:Robin, Type:contract, Id:3675, Age:25.
Employee Details - Name:Crow, Type:permanent, Id:3676, Age:28
RESULT:
Thus the Parsing an XML document using DOM and SAX Parsers is been
done and executed successfully.
62
-
7/28/2019 Microsoft Word - PAAVAI
63/65
Ex. No: 10 SAMPLE WEB APPLICATION DEVELOPMENT IN THE
DATE: OPEN SOURCE ENVIRONMENT
AIM:
To create Sample web application development in the open source
environment.
ALGORITHM:
Step1: start the program
Step2: Inside the asp definition tag include the html contents
Step3: include the code for the database connectivity using the ado object
Step4: select all the data form the student table
Step5: Traverse all the tuples in the table
Step6: Print the data
Step7: close the connection
Step8: stop the program
63
-
7/28/2019 Microsoft Word - PAAVAI
64/65
PROGRAM:
access.asp file:
con.open "dsn=cse;"
set rs=Server.Createobject("ADODB.RecordSet")
set rs=con.Execute("select * from student where name="&name&")%>
stuaccess.html:
Name
64
-
7/28/2019 Microsoft Word - PAAVAI
65/65
OUTPUT:
RESULT:
Thus the Sample web application development in the open source