Professional Documents
Culture Documents
Laboratory Manual
1
PREFACE
Web Technology is one of the important subjects included in the third year
curriculum by JNTUH. In addition to theory subject also includes Web technology as
lab practical’s using different languages and technologies like HTML,Java
Script,XML,Servlets and JSPs
HyperText Markup Language (HTML), the markup scheme used to prepare a wide
range of documents for dissemination via the World Wide Web. Although HTML has been
around for some time now, it is only recently that it has been formalized and its syntax and
semantics set down in a consistent--and machine-verifiable—format.HTML is used to create
web pages.
JavaScript was first introduced as part of Netscape Navigator in 1996. JavaScript’s
original goal was to improve the user experience of web pages. Instead of going back to the
server for simple tasks such as form validation, JavaScript allowed embedding of this
functionality directly in the page. JavaScript (JS) is an interpreted computer programming
language. As part of web browsers, implementations allow client-side scripts to interact with
the user, control the browser, communicate asynchronously, and alter the document content
that is displayed.
Extensible Markup Language (XML) is a markup language that defines a set of rules for
encoding documents in a format that is both human-readable and machine-readable. It is
defined in the XML 1.0 Specification produced by the W3C, and several other related
specifications, all free open standards.
The servlet is a Java programming language class used to extend the capabilities of a
server. Although servlets can respond to any types of requests, they are commonly used to
extend the applications hosted by web servers, so they can be thought of as Java Applets that
run on servers instead of in web browsers. These kinds of servlets are the Java counterpart to
other dynamic Web content technologies such as PHP and ASP.NET.
Java Server 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, but it uses the Java programming language.
JDBC is a Java-based data access technology (Java Standard Edition platform) from
Oracle Corporation. This technology is an API for the Java programming language that defines
how a client may access a database. It provides methods for querying and updating data in a
database. JDBC is oriented towards relational databases. A JDBC-to-ODBC bridge enables
connections to any ODBC-accessible data source in the JVM host environment.
2
LAB CODE
1. Students should report to the concerned lab as per the time table.
2. Students who turn up late to the labs will in no case be permitted to do the program
schedule for the day.
3. After completion of the program, certification of the concerned staff in-charge in the
observation book is necessary.
4. Student should bring a notebook of 100 pages and should enter the readings
/observations into the notebook while performing the experiment.
5. The record of observations along with the detailed experimental procedure of the
experiment in the immediate last session should be submitted and certified staff member
in-charge.
7. Students are required to prepare thoroughly to perform the experiment before coming to
laboratory.
8. Students are supposed to occupy the machines allotted to them and are not
supposed to talk or make noise in the lab. The allocation is put up on the lab
notice board.
9. Lab can be used in free time / lunch hours by the students who need to use the
systems should take prior permission from the lab in-charge.
3
INDEX
4
WEB TECHNOLOGIES LAB
JNTU SYLLABUS
Objective :
To create a fully functional website with mvc architecture. To Develop an online Book store
using we can sell books (Ex amazon .com).
Week-1:
Design the following static web pages required for an online book store web site.
1) HOME PAGE:
Top frame : Logo and the college name and links to Home page, Login page, Registration page,
Catalogue page and Cart page (the description of these pages will be given below).
Left frame : At least four links for navigation, which will display the catalogue of respective
links.
For e.g.: When you click the link “CSE” the catalogue for CSE Books should be displayed in the
Right frame.
Right frame: The pages to the links in the left frame must be loaded here. Initially this page
contains description of the web site.
5
Logo Web Site Name
CSE
EEE
CIVIL
Fig 1.1
2) LOGIN PAGE:
Logo
CSE
ECE Login :
EEE Password:
CIVIL ese
Submit Reset
3) CATOLOGUE PAGE:
The catalogue page should contain the details of all the books available in the web site in a table.
6
Author Name. Publisher. Price. Add to cart button.
Logo
EEE
Book : AI $ 63
Author : S.Russel
CIVIL
Publication :
Princeton hall
Author : Watson
Publication : BPB
publications
Book : HTML in $ 50
24 hours
Publication : Sam
publication
7
Note: Week 2 contains the remaining pages and their description.
Week-2:
4) CART PAGE:
The cart page contains the details about the books which are added to the cart.
Logo
ECE
5) REGISTRATION PAGE:
8
6) Date of birth (3 select boxes)
WEEK 3:
VALIDATION:
Write JavaScript to validate the following fields of the above registration page.
Name (Name should contains alphabets and the length should not be less than 6 characters).
E-mail id (should not contain any invalid and must follow the standard pattern
name@domain.com)
Note : You can also validate the login page with these parameters.
Week-4:
Design a web page using CSS (Cascading Style Sheets) which includes the following:
In the style definition you define how each selector should work (font, color etc.).
Then, in the body of your pages, you refer to these selectors to activate the styles.
For example:
<HTML>
<HEAD>
<style type="text/css">
B.headline {color:red; font-size:22px; font-family:arial; text-
decoration:underline}
</style>
</HEAD>
9
<BODY>
<b>This is normal bold</b><br>
Selector {cursor:value}
For example:
<html>
<head>
<style type="text/css">
.xlink {cursor:crosshair}
.hlink{cursor:help}
</style>
</head>
<body>
<b>
<a href="mypage.htm" class="xlink">CROSS LINK</a>
<br>
<a href="mypage.htm" class="hlink">HELP LINK</a>
</b>
</body>
</html>
</HTML>
2) Set a background image for both the page and single elements on the page.
You can define the background image for the page like this:
BODY {background-image:url(myimage.gif);}
10
3) Control the repetition of the image with the background-repeat property.
As background-repeat: repeat
Tiles the image until the entire page is filled, just like an ordinary background
image in plain HTML.
A:link
A:visited
A:active
A:hover
Example:
<style type="text/css">
A:link {text-decoration: none}
A:visited {text-decoration: none}
A:active {text-decoration: none}
A:hover {text-decoration: underline; color: red;}
</style>
For example:
LAYER 1 ON TOP:
<div style="position:relative; font-size:50px; z-index:2;">LAYER 1</div>
<div style="position:relative; top:-50; left:5; color:red; font-size:80px; z-
index:1">LAYER 2</div>
LAYER 2 ON TOP:
<div style="position:relative; font-size:50px; z-index:3;">LAYER 1</div>
<div style="position:relative; top:-50; left:5; color:red; font-size:80px; z-
index:4">LAYER 2</div>
Selector {cursor:value}
For example:
<html>
<head>
11
<style type="text/css">
.xlink {cursor:crosshair}
.hlink{cursor:help}
</style>
</head>
<body>
<b>
<a href="mypage.htm" class="xlink">CROSS LINK</a>
<br>
<a href="mypage.htm" class="hlink">HELP LINK</a>
</b>
</body>
</html>
Week-5:
Write an XML file which will display the Book information which includes the following:
2) Author Name
3) ISBN number
4) Publisher name
5) Edition
6) Price
Write a Document Type Definition (DTD) to validate the above XML file.
The contents should be displayed in a table. The header of the table should be in color GREY.
And the Author names column should be displayed in one color and should be capitalized and in
bold. Use your own colors for remaining columns.
Use XML schemas XSL and CSS for the above purpose.
12
Note: Give at least for 4 books. It should be valid syntactically.
Week-6:
VISUAL BEANS:
The shape of the area depends on the property shape. If it is set to true then the shape of the area
is Square and it is Circle, if it is false.
The color of the area should be changed dynamically for every mouse click. The color should
also be changed if we change the color in the “property window “.
Week-7:
While installation assign port number 4040 to TOMCAT and 8080 to APACHE. Make sure that
these ports are available i.e., no other process is using this port.
Access the above developed static web pages for books web site, using these servers by putting
the web pages developed in week-1 and week-2 in the document root.
Week-8:
User Authentication :
Assume four users user1,user2,user3 and user4 having the passwords pwd1,pwd2,pwd3 and
pwd4 respectively. Write a servelet for doing the following.
1. Create a Cookie and add these four user id’s and passwords to this Cookie.
2. Read the user id and passwords entered in the Login form (week1) and authenticate with the
values (user id and passwords ) available in the cookies.
If he is a valid user(i.e., user-name and password match) you should welcome him by name(user-
name) else you should display “ You are not an authenticated user “.
13
Use init-parameters to do this. Store the user-names and passwords in the webinf.xml and access
them in the servlet by using the getInitParameters() method.
Week-9:
Create a table which should contain at least the following fields: name, password, email-
id, phone number(these should hold the data from the registration form).
Write a java program/servlet/JSP to connect to that database and extract data from the
tables and display them. Experiment with various SQL queries.
Insert the details of the users who register with the web site, whenever a new user clicks the
submit button in the registration page (week2).
Week-10:
Insert the details of the 3 or 4 users who register with the web site (week9) by using
registration
form. Authenticate the user when he submits the login form using the user name and
password
Week-11:
Create tables in the database which contain the details of items (books in our case like Book
name , Price, Quantity, Amount )) of each category. Modify your catalogue page (week 2)in
such a way that you should connect to the database and extract data from the tables and display
them in the catalogue page using JDBC.
Week-12:
The user may add some items to cart from the catalog page. He can check the cart page
for the
14
selected items. He may visit the catalogue again and select some more items. Here our interest is
the selected items should be added to the old cart rather than a new cart. Multiple users can do
the same thing at a time(i.e., from different systems in the LAN using the ip-address instead of
localhost). This can be achieved through the use of sessions. Every user will have his own
session which will be created after his successful login to the website. When the user logs out his
session should get invalidated (by using the method session.invalidate() ).
Modify your catalogue and cart JSP pages to achieve the above mentioned functionality
using sessions.
15
OBJECTIVE
TO STUDENTS
Dear Students,
16
EXPERIMENT NO: 1
AIM: Design the static web pages required for an online bookstore web site.
THEORY:
1) HOME PAGE:
Top frame : Logo and the college name and links to Home page, Login
page, Registration page, Catalogue page and Cart page (the description of
these pages will be given below).
Left frame: At least four links for navigation, which will display the catalogue
of respective links. For e.g.: When you click the link “CSE” the catalogue for
CSE Books should be displayed in the Right frame.
Right frame: The pages to the links in the left frame must be loaded here.
Initially this page contains description of the web site.
Web Site
Name
Logo
CSE
ECE Description of the Web Site
EEE
CIVIL
Fig 1.1
2) LOGIN PAGE:
17
This page looks like below:
CSE
ECE Login :
EEE Password:
CIVIL
Submit Reset
3) CATOLOGUE PAGE:
The catalogue page should contain the details of all the books available in the web site in a
table.
2. Author Name.
3. Publisher.
4. Price.
18
Bible $ 40.5
ECE Author :
Winston
Publication :
EEE Wiely
CIVIL Book : AI $ 63
Author :
S.Russel
Publication :
Princeton hall
Author : Watson
Publication :
BPB
publications
Book : HTML $ 50
in 24 hours
Author : Sam
Peter
Publication :
Sam publication
ALGORITHM:
1. Create the Blank Pages
19
2. Create the frames
OUT PUT :
20
Figure 2 Login Page
INFERENCE:
Internet web browser is available in your system and its enable to bypass
the proxies for local address.
21
APPLICATIONS:
Standard front end for all web based application
EXTENSION:
With the help of cascading style sheet, the look and feel could be better, which you will do
in Experiment 4.
23
EXPERIMENT NO: 2
AIM: Design the static web pages required for an online bookstore web site.
THEORY:
4) CART PAGE:
The cart page contains the details about the books which are added to the cart.
Total $13
amount - 0.5
5) REGISTRATION PAGE:
24
7) Languages known (check boxes – English, Telugu, Hindi, Tamil)
ALGORITHM:
1. Continue from the Experiment 1
1.
OUTPUT:
25
Figure 2 Cart page
INFERENCE:
Internet web browser is available in your system and its enable to bypass the proxies for
local address.
APPLICATIONS:
EXTENSION:
With the help of cascading style sheet, the look and feel could be better, which you will do
in Experiment 4.
26
b)<td leftalign>
c)<td align="left">
d)<td valign="left">
3.How can you make a list that lists the items with numbers?
a)<list>
b)<dl>
c)<ol>
d)<ul>
4.How can you make a list that lists the items with bullets?
a)<list> b)<dl>
c) <ol> d)<ul>
EXPERIMENT NO: 3
1. Name (Name should contains alphabets and the length should not be less than 6
characters).
3. E-mail id (should not contain any invalid and must follow the standard
pattern name@domain.com)
ALGORITHM:
27
1. Continue from the Experiment 2
OUT PUT:
28
Figure 4 pwd must not same as uname
29
Figure 6 phone number in 999-999-9999 format
INFERENCE:
Internet web browser is available in your system and its enable to bypass the proxies for
local address.
APPLICATIONS:
Standard front end for all web based application.
EXTENSION:
You can also validate the login page with these parameters.
2. What is the correct JavaScript syntax to write "Hello World"? ("Hello World")
a)document.write("Hello World")
b)"Hello World"
c)response.write("Hello World")
30
3. Where is the correct place to insert a JavaScript? Both the <head> section and the
<body> section are correct
a)The <head> section b)The <body> section
9. How do you write a conditional statement for executing some code if "i" is
equal to 5? if i=5 then
a)if
b) i=5
b)if (i=5)
c)if i=5 then
d)none
10. How do you write a conditional statement for executing some code if "i" is NOT
equal to 5?
a)if <>5
31
b)if (i <> 5)
c)if =! 5 then
d) if (i != 5)
EXPERIMENT NO: 4
Design a web page using CSS (Cascading Style Sheets) which includes the following:
In the style definition you define how each selector should work (font, color etc.). Then, in
the body of your pages, you refer to these selectors to activate the styles. For example
<HTML>
<HEAD>
<style type="text/css">
B.headline {color:red; font-size:22px; font-family:arial; text-decoration:underline}
</style>
</HEAD>
<BODY>
<b>This is normal bold</b><br>
Selector {cursor:value}
For example:
<html>
<head>
<style type="text/css">
.xlink {cursor:crosshair}
.hlink{cursor:help}
</style>
</head>
<body>
<b>
<a href="mypage.htm" class="xlink">CROSS LINK</a>
<br>
<a href="mypage.htm" class="hlink">HELP LINK</a>
32
</b>
</body>
</html>
</HTML>
2) Set a background image for both the page and single elements on the page.
You can define the background image for the page like this:
BODY {background-image:url(myimage.gif);}
As background-repeat: repeat
Tiles the image until the entire page is filled, just like an ordinary background
image in plain HTML.
A:link
A:visited
A:active
A:hover
Example:
<style type="text/css">
A:link {text-decoration: none}
A:visited {text-decoration: none}
A:active {text-decoration: none}
A:hover {text-decoration: underline; color: red;}
</style>
For example:
33
LAYER 1 ON TOP:
<div style="position:relative; font-size:50px; z-index:2;">LAYER 1</div>
<div style="position:relative; top:-50; left:5; color:red; font-size:80px; z-
index:1">LAYER 2</div>
LAYER 2 ON TOP:
<div style="position:relative; font-size:50px; z-index:3;">LAYER 1</div>
<div style="position:relative; top:-50; left:5; color:red; font-size:80px; z-
index:4">LAYER 2</div>
Selector {cursor:value}
For example:
<html>
<head>
<style type="text/css">
.xlink {cursor:crosshair}
.hlink{cursor:help}
</style>
</head>
<body>
<b>
<a href="mypage.htm" class="xlink">CROSS LINK</a>
<br>
<a href="mypage.htm" class="hlink">HELP LINK</a>
</b>
</body>
</html>
ALGORITHM:
1. Create the Blank Page
34
3. Define the body properties
35
Figure 8 Embedded CSS
INFERENCE:
Internet web browser is available in your system and its enable to bypass the proxies for
local address.
APPLICATIONS:
EXTENSION:
You can also use some animation for the web page.
VIVA QUESTION :
1. What is CSS?
4. If background and color should always be set together, why do they exist as
separate properties?
5. What is class?
6. What is grouping?
36
7. What is external Style Sheet? How to link?
37
EXPERIMENT NO: 5
AIM: Write an XML file which will display the Book information.
THEORY:
Write an XML file which will display the Book information which includes the following:
2) Author Name
3) ISBN number
4) Publisher name
5) Edition
6) Price
Write a Document Type Definition (DTD) to validate the above XML file.
The contents should be displayed in a table. The header of the table should be in color GREY.
And the Author names column should be displayed in one color and should be capitalized and in
bold. Use your own colors for remaining columns.
Use XML schemas XSL and CSS for the above purpose.
ALGORITHM:
38
OUT PUT :
39
INFERENCE:
Internet web browser is available in your system and its enable to bypass the proxies for
local address. Java Script should be enabled for your web Browser.
APPLICATIONS:
Standard front end for all web based application.
EXTENSION:
Give at least for 4 books. It should be valid syntactically.
VIVA QUESTION :
1. What does XML stand for?
a)eXtensible Markup Language
b)Example Markup Language
c)eXtra Modern Link
d)X-Markup Language
40
2. There is a way of describing XML data, how? XML uses XSL to describe
data
a)XML uses a description node to describe data
b)XML uses a DTD to describe the data
c)none
4. What is the correct syntax of the declaration which defines the XML version?
a)<xml version="1.0" />
b)<?xml version="1.0" />
c)<?xml version="1.0"?>
d)none
41
c)All XML elements must be properly closed
d)All XML elements must be lower case
42
EXPERIMENT NO: 6
THEORY:
Create a simple visual bean with an area filled with a color.
The shape of the area depends on the property shape. If it is set to true then the shape of the area is
Square and it is Circle, if it is false.
The color of the area should be changed dynamically for every mouse click. The color should also
be changed if we change the color in the “property window “.
ALGORITHM:
1. Create a directory for the new Bean.
7. Test.
OUTPUT:
43
INFERENCE:
Java Runtime Environment should be enabled.
APPLICATIONS:
Standard front end for all windows based application.
EXTENSION:
Design a Color Picker.
C. A bean must provide both accessor method and mutator method for each data field
in the
class.
D.A bean property must be defined as a data field.
E. Every Java GUI component is a JavaBeans component.
3 The signature for the accessor method of a Date property birthDate should be
__________.
A.public java.util.Date birthDate()
B. public java.util.Date getbirthDate()
44
D.private java.util.Date birthDate()
E. private java.util.Date getBirthDate()
4 The signature for the mutator method of a Date property birthDate should be
__________.
A.public void birthDate()
B. public void setbirthDate()
C. public void setBirthDate(java.util.Date date)
D.public void birthDate(java.util.Date date)
5 The signature for the accessor method of a Boolean property visible should be
__________.
A.public boolean getVisible()
B. public boolean isVisible()
C. public static boolean isVisible()
D.public boolean visible()
E. private boolean isVisible()
45
A.java.util.EventListener
B. java.awt.ActionListener
C. javax.swing.JComponent
D.java.util.EventObject
9 The signature for the registration method for an ActionEvent should be __________.
A.public void setActionListener(ActionListener l)
B. public void addActionListener(ActionListener l)
C. public void addActionListener(ActionEvent l)
D.public void setAction(ActionListener l)
46
EXPERIMENT NO: 7
Name of the Experiment: Web Servers
While installation assign port number 4040 to TOMCAT and 8080 to APACHE. Make sure
that these ports are available i.e., no other process is using this port.
2) Access the above developed static web pages for books web site, using these servers
by
putting the web pages developed in week-1 and week-2 in the document root.
Access the pages by using the urls :http://localhost:8080/books.html (for Apache tomcat)
ALGORITHM:
3. Click on Advanced.
47
6. Create two new variables as follows:
10.Create a sample html file as home.html and access from the web browser as
http://localhost:8080/test/sample.html
INPUT:
In the web browser enter the following address http://localhost:8080/test/sample.html
OUTPUT:
INFERENCE:
Internet web browser is available in your system and its enable to bypass the proxies for
local address.
APPLICATIONS:
Web based application management.
48
EXTENSION:
You can also deploy complete assignment 1.
A.JSP is translated into Java servlet by a Web server when a JSP is called.
B. JSP is translated into HTML by a Web server when a JSP is called.
C. JSP is translated into XML by a Web server when a JSP is called.
D.YOu can embed Java code in JSP.
49
6 _______________ is a JSP declaration.
A.<%= i %>
B. <%= Math.pow(2, 3) %>
C. <%! private long computeFactorial(int n) { if (n == 0) return 1; else return n *
computeFactorial(n - 1); } %>
D.<% for (int i = 0; i <= 10; i++) { %>
E. <!-- HTML Comment -->
EXPERIMENT NO: 8
Name of the Experiment: User Authentication
THEORY:
Assume four users user1,user2,user3 and user4 having the passwords pwd1,pwd2,pwd3 and pwd4
respectively. Write a servelet for doing the following.
1. Create a Cookie and add these four users’ ids and passwords to this Cookie.
2. Read the user id and passwords entered in the Login form (week1) and authenticate with the
values (user id and passwords) available in the cookies.
If he is a valid user(i.e., user-name and password match) you should welcome him by name(user-
name) else you should display “ You are not an authenticated user “.
We can use init-parameters to do this. Store the user-names and passwords in the webinf.xml and
access them in the servlet by using the getInitParameters() method.
50
STEPS TO DEVELOP A WEB-APPLICATION IN ENTERPRISE EDITION
2. Create a directory with the name WEB-INF, this directory holds the Information
about the web-application.
5. In commandPrompt:
C:\Program Files\Apache Software Foundation\Tomcat6.0\bin\tomcat6.exe
6. Open the browser and type following at address
bar http://localhost:8080
51
Deploying the web application structure:
ALGORITHM:
3. Create the page to enter the new set of values for verification.
52
OUT PUT:
INFERENCE:
Internet web browser is available in your system and its enable to bypass the proxies for
local address.
APPLICATIONS:
EXTENSION:
53
Apply the cookies for Session tracking.
VIVA QUESTIONs :
EXPERIMENT NO: 9
Name of the Experiment: JDBC – User Registration
AIM: Create a table which should contain at least the following fields: name, password,
email-id, phone number(these should hold the data from the registration form).
Write a java program/servlet/JSP to connect to that database and extract data from the
tables and display them. Experiment with various SQL queries.
Insert the details of the users who register with the web site, whenever a new user clicks the
submit button in the registration page .
THEORY:
2. Create a table which should contain at least the following fields: name, password,
email-id, phone number(these should hold the data from the registration form).
5. Insert the details of the users who register with the web site, whenever a new user
clicks the submit button in the registration page (week2)..
ALGORITHM:
54
1. Create table USERDATA
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance() ;
DriverManager.getConnection("jdbc:oracle:thin:@SystemName:
PortNumber:DatabaseName","userId","Password");
con.prepareStatement(qur)
ps.executeQuery();
OUTPUT:
The Data will be available in database.
55
INFERENCE:
56
Internet web browser is available in your system and its enable to bypass the proxies for
local address.
APPLICATIONS:
For all your applications, this JDBC code will be applicable.
EXTENSION:
You can now make the entire application dynamic.
3. Which type of driver provides JDBC access via one or more ODBC drivers?
(a) Type 1 driver
(b) Type 2 driver
(c)Type 3 driver
(d) Type 4 driver
4. Which type of driver converts JDBC calls into the network protocol used by the
database management
system directly?
(a) Type 1 driver
(b) Type 2 driver
(c)Type 3 driver
(d) Type 4 driver
5. Which type of Statements can execute parameterized queries?
(a) PreparedStatement
(b) ParameterizedStatement
(c)ParameterizedStatement and CallableStatement
(d) All kinds of Statements (i.e. which implement a sub interface of Statement)
EXPERIMENT NO: 10
57
Name of the Experiment: JSP Development.
Insert the details of the 3 or 4 users who register with the web site (week9) by using registration
form. Authenticate the user when he submits the login form using the user name and password
from the database (similar to week8 instead of cookies).
ALGORITHM:
1. Create a page to display the Data
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance() ;
DriverManager.getConnection("jdbc:oracle:thin:@SystemName:
PortNumber:DatabaseName","userId","Password");
con.prepareStatement(qur)
ps.executeQuery();
OUT PUT:
58
59
INFERENCE:
Internet web browser is available in your system and its enable to bypass the proxies
for local address.
APPLICATIONS:
EXTENSION:
You can now make the entire application dynamic.
VIVA QUESTIONS
1)What is JSP?
EXPERIMENT NO: 11
AIM: Write a servlet that stores the user data in database and retrieve also.
THEORY:
Create tables in the database which contain the details of items (books in our case like Book
name , Price, Quantity, Amount )) of each category. Modify your catalogue page (week 2)in
such a way that you should connect to the database and extract data from the tables and
display them in the catalogue page using JDBC.
ALGORITHM:
1. First Load the class for Oracle JDBC
Class.forName("oracle.jdbc.driver.OracleDriver").newInstanc e() ;
60
DriverManager.getConnection("jdbc:oracle:thin:@SystemNa
me:PortNumber:DatabaseName","userId","Password");
OUT PUT:
61
INFERENCE:
Internet web browser is available in your system and its enable to bypass the proxies for
local address.
APPLICATIONS:
For all your applications, this JDBC code will be applicable.
EXTENSION:
You can now make the entire application dynamic.
VIVA QUESTIONs :
62
(C) Load Balancing is not possible (D) Both B and C
3). Which JDBC driver Type(s) can be used in either applet or servlet code? [ ]
(A) Both Type 1 and Type 2 (B) Both Type 1 and Type 3
(C) Both Type 3 and Type 4 (D) Type 4 only
4) ____________ interface provides methods for handling exceptions thrown while evaluating a
body of an action elements. []
a) Try b) TryCatchFinally c) TryCatch d) Finally
EXPERIMENT NO: 12
The user may add some items to cart from the catalog page. He can check the cart page
for the selected items. He may visit the catalogue again and select some more items. Here
our interest is the selected items should be added to the old cart rather than a new cart.
Multiple users can do the same thing at a time(i.e., from different systems in the LAN
using the ip-address instead of localhost). This can be achieved through the use of sessions.
Every user will have his own session, which will be created after his successful login to the
website. When the user logs out his session should get invalidated (by using the method
session.invalidate() ).
63
Modify your catalogue and cart JSP pages to achieve the above mentioned
functionality using sessions..
ALGORITHM:
1. Create a login Page.
2. Create a servlet page connected with HTML page which will create the
cookies.
OUT PUT:
64
65
INFERENCE:
Internet web browser is available in your system and its enable to bypass the proxies
for local address.
APPLICATIONS:
Session tracking for multi user environment.
EXTENSION:
66