Professional Documents
Culture Documents
1. Develop static pages (using only HTML) of an online book store. The
pages should resemble: www.amazon.com. The web site should consist of
the following pages.
Home Page
Registration and User login
User Profile Page
Books catalog
Shopping Cart
Payment By credit card
Order Conformation
WEB Technology LAB
Style.css
<style type="text/css">
body
background-color:skyblue;
.textbox
font-family:verdana;
color:orange;
#fs
float=center;
width:600px;
#lg
font-family:verdana;
font-size:20;
color:seablue;
.button
width:100px;
marquee
font-family:verdana;
color:red;
font-size:12;
font-weight:bold;
h1
float:right;
font-family:verdana;
color:green;
font-weight:bold;
</style>
WEB Technology LAB
Frame.html
<html>
<head>
<frameset rows="105,*">
<frameset cols="25,75">
</frameset>
</head>
WEB Technology LAB
WEB Technology LAB
Top.html
<html>
<head>
</head>
<body>
</marquee>
</h1>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
Home1.html
<html>
<head>
<style>
body
background-color:skyblue;
</style>
</head>
<body>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
Home.html
<html>
<head>
<style>
body
background-color:lightgreen;
legend
font-family:verdana;
</style>
</head>
<body>
<table>
<tr><td>
<ol>
</ol>
</td></tr>
</table>
</font>
</fieldset>
</body>
</html>
WEB Technology LAB
User_Login.html
<html>
<head>
<style>
body
background-color:skyblue;
</style>
</head>
<body>
<fieldset id="fs">
<font face=verdana>
<table align=center>
</table>
</font>
</fieldset>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
Registration.html
<html>
<head>
<style>
body
background-color:skyblue;
</style>
</head>
<body>
<fieldset id="fs">
<font face="verdana">
<form>
<table align=center>
</table>
</form>
</font>
</fieldset>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
User_Profile.html
<html>
<head>
<style>
body
background-color:skyblue;
</style>
</head>
<body>
<fieldset id="fs">
<font face="verdana">
<form>
<table align=center>
value="it"><b>IT</b></option><option
value="eee"><b>EEE</b></option><option
value="ece"><b>ECE</b></option><option
value="mech"><b>MECH</b></option><option
value="civil"><b>CIVIL</b></option></select></td></tr>
</table>
</form>
</font>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
Payment.html
<html>
<head>
<style>
body
background-color:skyblue;
</style></head>
<body>
<fieldset id="fs">
<font face="verdana">
<table align=center>
</font></body></html>
WEB Technology LAB
WEB Technology LAB
2. Validate the Registration, User Login, User Profile and Payment by Credit
Card pages using JavaScript.
WEB Technology LAB
User Login:-
<html>
<head>
<style>
body
background-color:skyblue;
</style>
<script language="javascript">
function fd()
if(document.fn.un.value=="")
document.fn.un.focus();
return false;
else
if(document.fn.pass.value=="")
document.fn.pass.focus();
return false;
else
return true;
</script>
</head>
<body>
<fieldset id="fs">
<font face=verdana>
<table align=center>
</table></form>
WEB Technology LAB
</font></fieldset>
</body></html>
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
Registration:-
<html>
<head>
<style>
body
background-color:skyblue;
</style>
<script language="javascript">
function fd()
if(document.fn.fn.value=="")
document.fn.fn.focus();
return false;
else
if(document.fn.ln.value=="")
{
WEB Technology LAB
document.fn.ln.focus();
return false;
else
if(document.fn.gender[0].checked==false &&
document.fn.gender[1].checked==false)
document.fn.gender.focus();
return false;
else
if(document.fn.branch.value=="")
document.fn.branch.focus();
return false;
else
if(document.fn.roll.value=="")
document.fn.roll.focus();
WEB Technology LAB
return false;
else
if(document.fn.add.value=="")
document.fn.add.focus();
return false;
else
if(document.fn.pass.value=="")
document.fn.pass.focus();
return false;
else
if(document.fn.rpass.value=="")
document.fn.rpass.focus();
return false;
document.fn.rpass.focus();
return false;
else
if(document.fn.dob.value=="")
document.fn.dob.focus();
return false;
else
return true;
</script>
</head>
<body>
<fieldset id="fs">
<font face="verdana">
<table align=center>
WEB Technology LAB
</table>
</form>
</font>
WEB Technology LAB
</fieldset>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
User Profile:-
WEB Technology LAB
<html>
<head>
<style>
body
background-color:skyblue;
</style>
<script language="javascript">
function fd()
if(document.fn.fn.value=="")
document.fn.fn.focus();
return false;
else
if(document.fn.ln.value=="")
document.fn.ln.focus();
return false;
else
if(document.fn.email.value=="")
document.fn.email.focus();
return false;
else
if(document.fn.branch.value=="")
document.fn.branch.focus();
return false;
else
if(document.fn.add.value=="")
document.fn.add.focus();
return false;
}
WEB Technology LAB
else
return true;
</script>
</head>
<body>
<fieldset id="fs">
<font face="verdana">
<table align=center>
<tr><td><b>Branch :</b></td><td>
<option value="cse"><b>CSE</b></option>
<option value="it"><b>IT</b></option>
<option value="eee"><b>EEE</b></option>
<option value="ece"><b>ECE</b></option>
<option value="mech"><b>MECH</b></option>
WEB Technology LAB
<option value="civil"><b>CIVIL</b></option>
</select></td></tr>
</table>
</form>
</font>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
Payment:-
WEB Technology LAB
<html>
<head>
<style>
body
background-color:skyblue;
</style>
<script language="javascript">
function fd()
if(document.fn.notb.value=="")
document.fn.notb.focus();
return false;
else
if(document.fn.holdname.value=="")
document.fn.holdname.focus();
return false;
else
if(document.fn.pin.value=="")
document.fn.pin.focus();
return false;
else
return true;
</script>
</head>
<body>
<fieldset id="fs">
<font face="verdana">
<table align=center>
</font>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB
3. Create and save an XML document at the server, which contain 10 users
information. Write a program, which takes User Id as an input and returns
the user details by taking the user information from the XML document.
WEB Technology LAB
users.xml:-
<?xml version="1.0"?>
WEB Technology LAB
<users>
<user1>
<uid>001</uid>
<uname>Nandan Singh Sengar</uname>
<dob>14/01/1988</dob>
</user1>
<user2>
<uid>002</uid>
<uname>Rakesh Rawat</uname>
<dob>23/06/1988</dob>
</user2>
<user3>
<uid>003</uid>
<uname>Rakesh Yadav</uname>
<dob>02/08/1988</dob>
</user3>
<user4>
<uid>004</uid>
<uname>Pavan</uname>
<dob>10/10/1988</dob>
</user4>
<user5>
<uid>005</uid>
<uname>Sandy</uname>
<dob>22/04/1988</dob>
</user5>
<user6>
<uid>006</uid>
<uname>Lala</uname>
<dob>29/09/1988</dob>
</user6>
WEB Technology LAB
<user7>
<uid>007</uid>
<uname>Sankar</uname>
<dob>22/02/1988</dob>
</user7>
<user8>
<uid>008</uid>
<uname>Satish</uname>
<dob>05/11/1988</dob>
</user8>
<user9>
<uid>009</uid>
<uname>Jobi</uname>
<dob>11/07/1988</dob>
</user9>
<user10>
<uid>010</uid>
<uname>Rahul</uname>
<dob>17/12/1988</dob>
</user10>
</users>
xml.html:-
<html>
WEB Technology LAB
<head>
<script type="text/javascript">
function fd()
{
var xmldoc=new ActiveXObject("Microsoft.XMLDOM");
xmldoc.load("users.xml");
var root=xmldoc.documentElement;
for(i=0;i<root.childNodes.length;i++)
{
var t2=document.f1.t1.value;
var child=root.childNodes.item(i);
var a=child.firstChild;
var b=a.parentNode;
if(t2==child.nodeName || t2==a.text)
{
for(i=0;i<b.childNodes.length;i++)
{
var c=b.childNodes.item(i);
document.writeln("<li>"+c.nodeName+"---
>"+c.text+"</li><br>");
}
}
}
}
</script>
</head>
<body bgcolor=silver>
<form name=f1 onSubmit="fd()">
<font face="verdana" size=3>
<table align=left>
<tr><td>Enter the User id : </td><td><input type=text
name=t1></td></tr><br>
<tr><td><input type=submit name=submit
value=Submit></td><td><input type=reset name=reset
value=Reset></td></tr><br>
WEB Technology LAB
</table>
</font>
</form>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
4. Create a Simple Bean which displays the color of the clicked object. The
created object also includes rectangle.
WEB Technology LAB
Colors.java:-
package sunw.demo.colors;
WEB Technology LAB
import java.awt.*;
import java.awt.event.*;
public class Colors extends Canvas {
transient private Color color;
private boolean rectangular;
public Colors() {
addMouseListener(new MouseAdapter() {
public void MousePressed(MouseEvent me) {
change();
}
});
rectangular = false;
setSize(200,100);
change();
}
public boolean getRectangular() {
return rectangular;
}
public void setRectangular(boolean flag) {
this.rectangular = flag;
repaint();
}
public void change() {
color = randomColor();
repaint();
}
private Color randomColor() {
int r = (int) (255 * Math.random());
int g = (int) (255 * Math.random());
WEB Technology LAB
Colors.mft:-
Name: E:/beans/demo/sunw/demo/colors/Colors.class
Java-Bean: True
Output:-
WEB Technology LAB
5. Install TOMCAT web server. Convert the static web pages of assignments
2 into dynamic web pages using servlets and cookies. HINT: User
WEB Technology LAB
1. Open the Internet explorer and go to the below link to download the
TOMCAT 5.5.28 on to your system.
http://datadispensory.com/apache/tomcat/tomcat-5/v5.5.28/bin/apache-
tomcat-5.5.28.exe
2. After downloading the software onto your system; double click on the
icon of the recently downloaded TOMCAT 5.5.28. A Wizard appears
which will guide you throughout your installation process.
3. When “Next” button is clicked, a EULA appears that is nothing but the
End User License agreement, hence the installation continuous if you
WEB Technology LAB
5. After choosing the components you required the setup ask for the
installation path i.e. the folder where you want to install the TOMCAT
5.5.28.
WEB Technology LAB
6. After defining the path or the folder where you want to install the
software, setup ask you to configure the software by asking
information such as “Connector port” Admin “username” and
“password”.
7. At last the software will also ask for the installation path of a J2SE 5.0
JRE i.e. nothing but the Java Virtual Machine.
WEB Technology LAB
8. After defining the path for the Java Virtual Machine you have to click
on “Install” button to install the software. On clicking the “Install”
button the installation process begins.
10. If you click on to “Run Apache Tomcat”, the Apache service manager
starts the Apache Tomcat.
2. Now open the internet explorer and give the URL address as :
http://localhost:8080/Date/date.html
<html>
<head>
WEB Technology LAB
</head>
<body bgcolor=silver>
<font face=verdana>
<table align=center>
</table>
</form>
</font>
</body>
</html>
<web-app>
WEB Technology LAB
<servlet>
<servlet-name>user</servlet-name>
<servlet-class>user</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>user</servlet-name>
<url-pattern>/user</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>GetCookieServlet</servlet-name>
<servlet-class>GetCookieServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GetCookieServlet</servlet-name>
<url-pattern>/GetCookieServlet</url-pattern>
</servlet-mapping>
</web-app>
import java.io.*;
WEB Technology LAB
import javax.servlet.*;
import javax.servlet.http.*;
Cookie[] cookies=req.getCookies();
PrintWriter pw=res.getWriter();
for(int i=0;i<cookies.length;i++)
String name=cookies[i].getName();
String value=cookies[i].getValue();
pw.println("name="+name+";"+"value="+value);
pw.close();
import java.io.*;
WEB Technology LAB
import javax.servlet.*;
import javax.servlet.http.*;
String userid=req.getParameter("uid");
String password=req.getParameter("pwd");
String credit=req.getParameter("ccnumber");
res.addCookie(c1);
res.addCookie(c2);
res.addCookie(c3);
PrintWriter out=res.getWriter();
out.println("USERID...."+userid);
out.println("<br>");
out.println("PASSWORD...."+password);
out.println("<br>");
out.println("CREDIT CARD NUMBER...."+credit);
}
}
COMPILATION PROCEDURE:-
1. After finishing writing the java files in “classes named folder do the
following.
WEB Technology LAB
http://localhost:8080/Nandan/user
To,
6. Redo the previous task using JSP by converting the static web pages of
assignments 2 into dynamic web pagers. Create a database with user
information and book information. The books catalogue should be
dynamically loaded from the database. Follow the MVC architecture while
doing the website.
WEB Technology LAB
1. First go to the
2. Then Select the drive for which you want to set up a Data Source. Choose
the name as “Oracle in OraHome92” and click Finish Button.
3. Then Choose Your Own Data Source Name and Press The “Test Connection”
Button To Check Whether The Connection is Working Or Not…
WEB Technology LAB
4.
5. To Test the Connection You Have to give The “Username” And “Password” Of
our Database and Then Click On “OK” Button to check Whether the Username
and Password Written Are Correct or Not and Also to Check Whether
Connection is Working Or Not.
http://localhost:8080/Nandanjsp/user.html
http://localhost:8080/Nandanjsp/reterive.jsp
user.html:-
<html>
<head>
</head>
<body bgcolor=silver>
<font face=verdana>
WEB Technology LAB
insert.jsp:-
<%@page import="java.sql.*"%>
<html>
<body>
<%
String firstname=request.getParameter("fn");
WEB Technology LAB
String lastname=request.getParameter("ln");
String branch=request.getParameter("branch");
String address=request.getParameter("add");
String email=request.getParameter("email");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:Nandan1","scott","tiger");
Statement st=con.createStatement();
int n=st.executeUpdate("insert into userinfo
values('"+firstname+"','"+lastname+"','"+branch+"','"+address+"','"+email
+"')");
%>
<b><%=n%>row inserted</b>
</body>
</html>
retrieve.jsp:-
<%@page import="java.sql.*"%>
<html>
<body>
<%
WEB Technology LAB
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:Nandan1","scott","tiger");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select *from userinfo");
%>
<table>
<%while(rs.next()){%>
<tr>
<td><%=rs.getString("firstname")%></td>
<td><%=rs.getString("lastname")%></td>
<td><%=rs.getString("branch")%></td>
<td><%=rs.getString("address")%></td>
<td><%=rs.getString("email")%></td>
</tr>
<%}%>
</table>
<%con.close();%>
</body>
</html>
WEB Technology LAB
WEB Technology LAB
WEB Technology LAB