Lab Mnanual Web Tech (KCS-652)
Lab Mnanual Web Tech (KCS-652)
GHAZIABAD
LAB MANUAL
1
. Experiment No. 1
Program Name:Write HTML/Java scripts to display your CV in navigator, your Institute website,
Department Website and Tutorial website for specific subject.
Implementation:
<html>
<head>
<title></title>
<style>
<!--
li.MsoNormal
{mso-style-parent:"";
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";
margin-left:0in; margin-right:0in; margin-top:0in}
-->
</style>
</head>
<body>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
bordercolor="#111111" width="70%" id="AutoNumber1" height="822">
<tr>
<tdalign="center" height="26"><b><font size="5">RAGHIB SRIVASTAVA</font></b></td>
</tr>
<tr>
<tdalign="center" height="17">
<span style="font-size: 11.0pt; font-family: Times New Roman">Room
No:-045, Senior Boys Hostel,</span></td>
</tr>
<tr>
<tdalign="center" height="17">
<p class="MsoNormal" align="center" style="text-align:center">
2
<span style="font-size:11.0pt">Ajay</span><span style="font-size:
11.0pt"></span><span style="font-size:11.0pt">Kumar Garg Engineering College,</span></td>
</tr>
<tr>
<tdalign="center" height="17">
<p class="MsoNormal" align="center" style="text-align:center">
<span style="font-size:11.0pt">Ghaziabad (U.P.)-201009.</span></td>
</tr>
<tr>
<tdalign="center" height="17">
<p class="MsoNormal" align="center" style="text-align:center">
<span style="font-size:11.0pt">Contact No.:- +919891498261</span></td>
</tr>
<tr>
<tdalign="center" height="17">
<p class="MsoNormal" align="center" style="text-align:center">
<span style="font-size:11.0pt">E-mail:-<a href="[email protected]"><span style="color:blue; text-
decoration:none">[email protected]</span></a></span></td>
</tr>
<tr>
<tdalign="center" height="19"> </td>
</tr>
<tr>
<tdalign="center" bgcolor="#808080" height="20"><b><font size="4">
Objectives</font></b></td>
</tr>
<tr>
<tdalign="center" height="38">
<p align="left">
<span style="font-size: 12.0pt; font-family: Times New Roman">To work in a
challenging and motivating environment where I can use my potential to the
very best and work towards refining my technical skills, knowledge and
personality.</span></td>
</tr>
<tr>
<tdalign="center" height="19"> </td>
</tr>
<tr>
<tdalign="center" bgcolor="#808080" height="20"><font size="4"><b>
Qualification</b></font></td>
</tr>
<tr>
<tdalign="center" height="99">
<ul style="margin-top: 0in; margin-bottom: 0in" type="disc">
<li class="MsoNormal">
<p align="left">Pursuing Bachelor of Technology (<b>Computer Science and
Engineering</b>) from Ajay Kumar Garg Engineering College, Ghaziabad.
Uttar Pradesh Technical University, Luckhnow. Aggregate Percentage
till 6<sup>th</sup> semester 75.0.</li>
<li class="MsoNormal">
<p align="left">
<span style="font-size: 12.0pt; font-family: Times New Roman">intermediate
<b></b> with 74% from v.s.e.cawadhpuri (u.p.board)</span></li>
<li class="MsoNormal">
3
<p align="left">
Output / Conclusion:Type the program in notepad and save the program with .html extension. Run the
program in Internet Explorer to display resume.
4
Experiment No. 2
Program Name: 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 Concepts: Use basic HTML tags to develop all programs and JDBC connectivity.
Implementation:
1. Index.html
<html>
<head>
<title>Pet Details</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form name="petDetails" method="post" action="SavePetDetails1">
Enter pet details
Name: <input type="text" name="name"/><BR>
Owner:<input type="text" name="owner"/><BR>
Species: <input type="text" name="species"/><BR>
Sex: <input type="text" name="sex"/><BR>
Birth: <input type="text" name="birth"/><BR>
Death: <input type="text" name="death"/><BR>
<input type="submit" name="submit"/>
</form>
</body>
</html>
2. SaveDetails.java
5
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
java.util.DatebdateStr = formatter.parse(birth);
java.sql.DatebdateDB = new java.sql.Date(bdateStr.getTime());
java.util.DateddateStr = formatter.parse(death);
java.sql.DateddateDB = new java.sql.Date(ddateStr.getTime());
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/db1?autoReconnect=true&useSSL=false","root","root");
String insString="INSERT INTO db1.pet VALUES (?,?,?,?,?,?)";
PreparedStatementinsStmt=con.prepareStatement(insString);
insStmt.setString(1, name);
insStmt.setString(2, owner);
insStmt.setString(3, species);
insStmt.setString(4, sex);
insStmt.setDate(5, bdateDB);
insStmt.setDate(6, ddateDB);
insStmt.executeUpdate();
con.close();
System.out.println("statement executed");
}catch(Exception e){ System.out.println(e);}
}
3. SavePetDetails.java
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author nghan
*/
@WebServlet(urlPatterns = {"/SavePetDetails1"})
public class SavePetDetails extends HttpServlet {
/**
*
* @param request
* @param response
* @throws ServletException
6
* @throws IOException
*/
System.out.println("Inside servlet"+name+owner+species+sex+birth+death);
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit
the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
7
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
Output / Conclusion:
Step 2: After clicking on Submit Query and the data saved successfully, following page is displayed.
8
Experiment No. 3
Program Name: Write programs using Java script for Web Page to display browsers information.
Implementation:
<head>
<head>
<title> Browser Information </title>
<script language=javascript>
function show()
{
document.write("Name "+navigator.appName+"<br>");
document.write("Version "+navigator.appVersion +"<br>");
document.write("Codename " +navigator.appCodeName +"<br>");
document.write("Cookie enable"+navigator.cookieEnabled +"<br>");
document.write("Java Enable"+navigator.javaEnabled +"<br>");
document.write("Mime type"+navigator.mimeTypes +"<br>");
document.write("Platform"+navigator.platform +"<br>");
document.write("Plug ins"+navigator.plugins +"<br>");
document.write("System Language"+navigator.systemLanguage +"<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()" />
9
</div>
</form>
</body>
</html>
Output / Conclusion: Save the above program as .html file and when user clicks on show following
page is displayed
1
0
Experiment No. 4
Program Name: Write a program in Java to allot rooms in the hostel using Inheritance. Incorporate method
overloading and method overriding concepts in the program.
Theory Concepts:Overloading: In same class, if name of the method remains common but the number
and type of parameters are different, then it is called method overloading in Java.Overriding: A method is
said to be overridden when one is in parent class and another is in child class with the same name, same
return type, and same parameter.
Inheritance :
Single level inheritance e.g. (class B extends Class A).
Multilevel inheritance e.g. (class C extends class B and class B extends Class A).
Multiple inheritance is not possible in JAVA.
Implementation:
1. Base abstract class Room
}
public booleanallotRoom(String[] allotee)
1
1
{
return true;
}
public booleanallotRoom(String allotee)
{
return true;
} }
2. Class SingleBedRoom
public class SingleBedRoom extends Room{
private String allotedTo;
public booleanallotRoom(String allotee)
{
setAllotedTo(allotee);
System.out.println("Room allotted successfully");
return true;
}
public void setAllotedTo(String allotee)
{
this.allotedTo=allotee;
}
}
3. Class DoubleBedRoom
public class DoubleBedRoom extends Room{
private String allotedTo;
public booleanallotRoom(String[] allotee)
{
System.out.println("Room allotted successfully");
for(int i=0;i<allotee.length;i++)
{
setAllotedTo(allotee[i]);
}
System.out.println("Room allotted successfully");
return true;
}
1
2
4. Class RoomReserve
public class RoomReserve {
public static void main(String[] args)
{
Scanner userInput =new Scanner(System.in) ;
System.out.println("Which type of room do you want to reserve");
String roomType = userInput.nextLine();
if(roomType.equals("Single"))
{
Room singleBed= new SingleBedRoom();
System.out.println("Enter the name of person");
String userName=userInput.nextLine();
singleBed.allotRoom(userName);
}
else
{
Room doubleBed= new DoubleBedRoom();
System.out.println("Enter the name of persons");
String userName=userInput.nextLine();
doubleBed.allotRoom(userName);
}
userInput.close();
}
}
1
3
Output / Conclusion:
Step 1: When user enters room type as Single, single bedroom is reserved.
Step 2: When user enters room type as double, double bedroom is reserved.
1
4
Experiment No. 5
Program Name:Develop a program in Java to run three threads of the program simultaneously using
multithreading. Include try, catch block in the program.
Theory Concepts:Create a class which implements Runnable interface. Create three threads for the
implemented class’s object and observe their behavior.
Implementation:
1
5
Output / Conclusion:The threads will execute the run method simultaneously.
name=First Thread5
name=Third Thread5
name=Second Thread5
main thread5
name=First Thread4
name=Second Thread4
main thread4
name=Third Thread4
name=First Thread3
main thread3
name=Second Thread3
name=Third Thread3
name=First Thread2
main thread2
name=Second Thread2
name=Third Thread2
name=First Thread1
name=Second Thread1
main thread1
name=Third Thread1
Experiment No. 6
Program Name: Write a Java applet to display the Application Program screen i.e. calculator and
other.
Implementation:
import java.applet.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;;
public class calculator extends Applet implements ActionListener, TextListener
{
String s,s1,s2,s3,s4;
Button b1,b2,b3,b4,b5,b6,b7,b8,b9,b0;
Button add,sub,eq,cl,mul,div;
1
6
TextField t1;
int a,b,c;
GridLayoutgb=new GridLayout(4,5);
setLayout(gb);
add(t1);
add(b1);
add(b2);
add(b3);
add(b4);
add(b5);
add(b6);
add(b7);
add(b8);
add(b9);
add(b0);
add(add);
add(sub);
add(mul);
add(div);
add(eq);
add(cl);
b1.addActionListener(this);
b2.addActionListener(this);
1
7
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
b0.addActionListener(this);
add.addActionListener(this);
sub.addActionListener(this);
mul.addActionListener(this);
div.addActionListener(this);
eq.addActionListener(this);
cl.addActionListener(this);
paint();
//t1.addTextListener(this);
}
public void paint()
{
setBackground(Color.green);
}
1
8
t1.setText("");
s3="*";
}
if(s.equals("*"))
{
s2=t1.getText();
t1.setText("");
s3="*";
}
if(s.equals("="))
{
s4=t1.getText();
a=Integer.parseInt(s2);
b=Integer.parseInt(s4);
if(s3.equals("+"))
c=a+b;
if(s3.equals("-"))
c=a-b;
t1.setText(String.valueOf(c));
}
if(s.equals("Clear"))
{
t1.setText("");
}
}
public void textValueChanged(TextEvent e)
{
}
}
Output / Conclusion:
1
9
Experiment No. 7
Program Name: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 Concepts: An XML file is created with DTD. A style sheet in CSS format is also created for that
XML file. XML With DTD and CSS files are combined together to check the output on browser’s screen.
Implementation:
1. XML With DTD
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>
2
1
</product>
</products>
Output / Conclusion:
2
2
Experiment No. 8
Program Name: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 JDVC Socket.
Implementation:
package javaapplication;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Connect {
// variables
Connection connection = null;
Statement statement = null;
ResultSetresultSet = null;
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
}
catch(ClassNotFoundExceptioncnfex) {
2
3
// Step 2.B: Creating JDBC Statement
statement = connection.createStatement();
System.out.println("ID\tPlayerName\tAge\tRuns");
System.out.println("==\t===========\t===\t=======");
Output / Conclusion:
2
4
Experiment No. 9
Program Name:Install TOMCAT web server and APACHE. Access the above developed static web
pages for books web site, using these servers by putting the web pages developed
Theory Concepts:Configuring & Using Apache Tomcat 4. A Tutorial on Installing and Using Tomcat
for Servlet and JSP Development.
Explanation:-
2
5
Configure Tomcat
The ROOT context is the default Web application in Tomcat, and is convenient to use when you are first
learning about servlets and JSP (although you'll use your own Web applications once you're more
experienced). The default Web application is already enabled in Tomcat, Tomcat 4.0.1-4.0.3, and Tomcat
4.1. But, in Tomcat 4.0.4 it is disabled by default. To enable it, uncomment the following line in
install_dir/conf/server.xml:
Assuming you have no other server already running on port 80, you'll find it convenient to configure Tomcat
to run on the default HTTP port (80) instead of 8080. Making this change lets you use URLs of the form
http://localhost/blah instead of http://localhost:8080/blah. Note that you need admin privileges to make this
change on Unix. Also note that Windows XP automatically starts IIS on port 80. So, if you use XP and want
to use port 80 for Tomcat, you'll need to disable IIS.
To change the port, edit install_dir/conf/server.xml and change the port attribute of the Connector element
from 8080 to 80, yielding the result below.
<Connector
className="org.apache.catalina.connector.http.HttpConnector"
port="80" ...
... />
The next step is to tell Tomcat to check the modification dates of the class files of requested servlets and
reload ones that have changed since they were loaded into the server's memory. This degrades performance
in deployment situations, so is turned off by default. However, if you fail
2
6
to turn it on for your development server, you'll have to restart the server every time you recompile a
servlet that has already been loaded into the server's memory.
<!-- Define properties for each web application. This is only needed if you want to set non-default
properties, or have web application document roots in places other than the virtual host's appBase directory.
-->
<DefaultContext reloadable="true"/>
Be sure to make a backup copy of server.xml before making the above change.
Next, you must set the JAVA_HOME environment variable to tell Tomcat where to find Java. Failing to
properly set this variable prevents Tomcat from handling JSP pages. This variable should list the base JDK
installation directory, not the bin subdirectory. For example, if you are on Windows 98/Me and installed the
JDK in C:\JDK1.3_01, you might put the following line in your autoexec.bat file.
set JAVA_HOME=C:\JDK1.3_01
On Windows NT/2000/XP, you would go to the Start menu and select Settings, then Control Panel, then
System, then Environment. Then, you would enter the JAVA_HOME value.
Rather than setting the JAVA_ HOME environment variable globally in the operating system, some
developers prefer to edit the startup script to set it there. If you prefer this strategy, edit
install_dir/bin/catalina.bat and change the following:
to:
set JAVA_HOME=C:\JDK1.3_01
:gotJavaHome
Be sure to make a backup copy of catalina.bat before making the changes. Also note that the exact details of
the existing catalina.bat file change a bit in different minor releases of Tomcat 4.
If you use Windows, you may also have to change the DOS memory settings for the startup and shutdown
scripts. If you get an "Out of Environment Space" error message when you start the server, you will need to
right-click on install_dir/bin/startup.bat, select Properties, select Memory, and change the Initial
2
7
Environment entry from Auto to at least 2816. Repeat the process for install_dir/bin/shutdown.bat.
If you are going to make copies of the Tomcat startup or shutdown scripts, it is also helpful to set the
CATALINA_HOME environment variable to refer to the top-level directory of the Apache Tomcat
installation (e.g. C:\jakarta- tomcat- 4.0). This variable identifies the Tomcat installation directory to the
server. However, if you are careful to avoid copying the server startup scripts and you use only shortcuts
(called "symbolic links" on Unix/Linux) instead, you are not required to set this variable.
Experiment No. 10
Program Name: Assume four users user1, user2, user3 and user4 having the passwords pwd1, pwd2, pwd3
and pwd4 respectively. Write a Servlet for doing the following. 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 and authenticate with the
values available in the cookies.
Implementation:
/* HTML page to capture user data - Part:1 */
<html>
<head>
<title>Experiment No. 10</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form action = "HelloForm" method = "GET">
User 1: <input type = "text" name = "u1"><br />
password: <input type = "text" name = "p1" />
User 2: <input type = "text" name = "u2"><br />
password: <input type = "text" name = "p2" />
User 3: <input type = "text" name = "u3"><br />
password: <input type = "text" name = "p3" />
User 4: <input type = "text" name = "u4"><br />
password: <input type = "text" name = "p4" />
<input type = "submit" value = "Submit" /></form>
</body>
</html>
2
8
/* Servlet to process the result, create cookies and set it in the response - Part:2 */
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
@WebServlet(urlPatterns = {"/HelloForm"})
public class HelloForm extends HttpServlet {
response.addCookie( u1 );
response.addCookie( p1 );
response.addCookie( u2 );
response.addCookie( p2 );
response.addCookie( u3 );
response.addCookie( p3 );
response.addCookie( u4 );
response.addCookie( p4 );
}
}
2
9
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
cookies = request.getCookies();
response.setContentType("text/html");
3
0
out.print("Name : " + cookie.getName( ) + ", ");
out.print("Value: " + cookie.getValue( ) + " <br/>"); }
} else
{ out.println("<h2>No cookies founds</h2>"); }
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}
<servlet>
<servlet-name>ReadCookies</servlet-name>
<servlet-class>ReadCookies</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ReadCookies</servlet-name>
<url-pattern>/ReadCookies</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
3
1
</session-config>
<welcome-file-list>
<welcome-file>
index.html
</welcome-file>
</welcome-file-list>
</web-app>
Output / Conclusion:The following is the page displayed for capturing information from the user.
Step 1: Run index.html file
3
2
3
3
Experiment No. 11
Program Name:Install a database (MySQL or Oracle). Create a table which should contain at least the
following fields: name, password, email-id, phone number Write a java program/Servlet/JSP to connect to that
database and extract data from the tables and display them. 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 Concepts: This program is basic login page which takes data from the user and inserts it in the
database table. It also fetches the details of the data that has already been inserted in the table.
Implementation:
Index.html
<html>
<head>
<title>JspWithMysql</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<form action="registration.jsp" method="post">
username:
<input type="text" name="username" >
password:
<input type="password" name="password" >
email:
<input type="text" name="email" >
phoneNo:
<input type="text" name="phone">
<input type="submit" name="submit">
</form>
</body>
</html>
Registration.jsp
</body>
</html>
Output / Conclusion
After Registration
Experiment – 12
Program Name: Write a JSP which insert the details of the 3 or 4 users who register with the web site by
using registration form. Authenticate the user when he submits the login form using the user name and password
from the database.
Theory Concepts: This program demonstrates how the JSP can be used to insert the data in the database
3
5
tables. Later when login is to be performed how the data from the database can be used to authenticate the
user.
Implementation:
Index.html
<html>
<head>
<title>JspWithMysql</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body
<form action="registration.jsp" method="post">
username:
<input type="text" name="username" >
password:
<input type="password" name="password" >
<input type="submit" value="login">
</form>
</body>
</html>
registration.jsp
<html>
<head>
<title>Registration</title>
</head>
<body>
<sql:setDataSource var = "snapshot" driver = "com.mysql.jdbc.Driver"
url = "jdbc:mysql://localhost/TEST"
user = "root"/>
Output / Conclusion
3
6
Experiment – 13
Program Name: Write a program to implement a simple shopping cart example with session tracking
API in JSP
Theory Concepts: The program is demonstrating example of shopping cart using session tracking in
JSP.
Implementation:
<!DOCTYPE html>
<html>
<head>
<title>Sesssion in JSP </title>
</head>
<body>
<h1>Hello World!</h1>
<TABLE>
<% String [] titles = {"SamsungGalaxy", "FastTrackWatch", "ParkAvenue", "RacingCar",
"DollHouse"};
for (int j=0; j <titles.length; j++)
{
%>
<TR>
<TD><%= titles[j] %></TD>
<TD><A HREF=ShoppingCart.jsp?itemName=<%= titles[j]%>>
Add to Shopping Cart</A></TD>
3
7
</TR>
<% } %>
</TABLE>
Output / Conclusion:
3
8