Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Jntu web technologies record manual for engineering students
1. JNTU WEB TECHNOLOGIES RECORD MANUAL FOR ENGINEERING STUDENTS
Week-1
Aim: To design the following static web pages required for an online book store website.
HOME PAGE
The static home page must contain three frames.
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 book should be displayed in the
Right Frame.
Right frame: The page to the link in the left frame must be loaded here. Initially this page
contains description of the website.
Program:
frame1.html
<html>
<head>
<title>frame</title>
</head>
<frameset rows=”25,*”>
<frame src=”topframe.html” scrolling=”no”>
<frameset cols=”10 %,*”>
<frame src=”leftframe.html”>
<frame src=”rightframe.html” name=”xyz”>
</frameset>
</frameset>
</html>
topframe.html
<html>
<head>
<title>topframe</title>
</head>
<body bgcolor=”grenn”>
<table width=”100%” align=”center” cellspacing=”0”>
<tr>
<th><img width=”100” height=100 src=”c:.......image url……….paste……></th>
<th colspan=5><h1 font color=”skyblue”>……….COLLEGE NAME………..</font></h1>
<tr>
2. <th> <a href=”home.html”target=”xyz”><h3>HOME </a></h3>
<th> <a href=”login.html”target=”xyz”><h2> </a>LOGIN</h2>
<th> <a href=”registration.html”target=”xyz”><h2>REGISTRATION</a></h2>
<th> <a href=”catalogue.html”target=”xyz”><h2>CATALOGUE </a></h2>
<th> <a href=”cart.html”target=”xyz”><h2> CART</a></h2>
</tr
</table>
</body>
</html>
rightframe.html
<html>
<head>
<title>rightframe</title>
<body bgcolor=”mediumorchid”>
<p><i><font color=”white” width=”5”>
……………..Just you have to write about your college in this area……………..
</body>
</html>
leftframe.html
<html>
<head>
<title>leftframe</title>
<body bgcolor=”red”>
<a href=”cse.html”target=”xyz”><font color=”white” width=”3”>CSE</a><br><br>
<a href=”ece.html”target=”xyz”><font color=”white” width=”3”>ECE</a><br><br>
<a href=”civil.html”target=”xyz”><font color=”white” width=”3”>CIVIL</a><br><br>
<a href=”eee.html”target=”xyz”><font color=”white” width=”3”>EEE</a><br><br>
</head>
</body>
<html>
cse.html
<html>
<head>
<title>cse</title>
</head>
<body>
<p>
……………….Write the content about CSE……………………….
</p>
3. </body>
</html>
ece.html
<html>
<head>
<title>ece</title>
</head>
<body>
<p>
……………….Write the content about ECE……………………….
</p>
</body>
</html>
civil.html
<html>
<head>
<title>civil</title>
</head>
<body>
<p>
……………….Write the content about CIVIL……………………….
</p>
</body>
</html>
eee.html
<html>
<head>
<title>eee</title>
</head>
<body>
<p>
……………….Write the content about EEE……………………….
</p>
</body>
</html>
LOGIN
AIM: To design the following static webpage to display login page.
4. Program:
<html>
<head>
<title> New Document</title>
</head>
<body leftmargin=”300”>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<pre>
Name :<input type=”text” value=”” size=”20”><br>
Password :<input type=”password” value=”” size=”20”><br>
<input type=”submit” value=”submit” size=”20”><br>
<input type=”reset” value=”reset” size=”20”>
</pre>
</body>
</html>
CATALOGUE PAGE
The catalogue page should contain the details of all the books available in the website in a table.
The details should contain the following:
1. Snapshot of cover page
2. Author name
3. Publisher
4. Price
5. Add to cart button
Program:
catalogue.html
<html>
<head>
<title>catalogue</title>
</head>
<body bgcolor=”lightgreen”>
<table colspan=”4” width=”100%” align=”center”>
<tr>
<td><img width=”50” src=”………….paste the image url………….”>
5. <td>book: …..Name…….<br>
Author:…Name…<br>
Publication:…Name….
<td>$...price…<input typr=”reset” value=”add to cart”>
</tr>
<tr>
<td><img width=”50” src=”………….paste the image url………….”>
<td>book: …..Name…….<br>
Author:…Name…<br>
Publication:…Name….
<td>$...price…<input typr=”reset” value=”add to cart”>
</tr>
<tr>
<td><img width=”50” src=”………….paste the image url………….”>
<td>book: …..Name…….<br>
Author:…Name…<br>
Publication:…Name….
<td>$...price…<input typr=”reset” value=”add to cart”>
</tr>
<tr>
<td><img width=”50” src=”………….paste the image url………….”>
<td>book: …..Name…….<br>
Author:…Name…<br>
Publication:…Name….
<td>$...price…<input typr=”reset” value=”add to cart”>
</tr>
</table>
</html>
WEEK-2
CART PAGE
Aim: To write a program to display the cartpage contains the details about the book which are
added to cart.
Program:
cart.html
<html>
<head>
<title>cart</title>
</head>
<body>
6. <table>
<tr>
<td>
<tr>
<td>…Book Name…<th>$...Book Price…<td>$...Total Price…></tr>
<tr>
<td>…Book Name…<th>$... Book Price…<td>$...Total Price …></tr>
<tr>
<td>…Book Name…<th>$... Book Price…<td>$...Total Price …></tr>
<tr>
<td>…Book Name…<th>$... Book Price…<td>$...Total Price …></tr>
<tr>
<td><td><td>Total Amount<td>…………..------…………..</tr><br>
</table>
</body>
</html>
Registration Page
Aim: To create a Registration page with the following fields
1. Name(text field)
2. Password(password field)
3. E=mail(text field)
4. Phone number(text field)
5. Sex(radio button)
6. Date of birth(3 select boxes)
7. Languages known(check-boxes)
8. Address(text area)
Program:
registration.html
<html>
<head>
<title>registration</title>
</head>
<body bgcolor=”lightblue”>
,table width=”90%”>
<tr>
<td><pre> Name :<input type=”text” value=” ” size=”20”><tr></pre>
<tr>
<td><pre>E-mail :<input type=”text” value=” ” size=”30”><tr></pre>
<tr>
<td><pre>Password :<input type=”password” value=” ” size=”10”><tr></pre>
<tr>
9. <option>2004
<option>2005
<option>2006
<option>2007
<option>2008
<option>2009
<option>2010
<option>2011
<option>2012
</select>
</tr></pre>
<tr>
<td><pre>Address :<textarea value=”” rows=”3” cols”10”></textarea>
<pre><input type=”submit” value=”submit” size=”20”>
<input type=”reset” value=”reset” size=”20”>
</pre>
</tr></pre>
<table>
</body>
</html>
WEEK-3
VALIDATION: Registration Page
Aim: To write a java Script to validation the following fields of registration page.
1. Name(name should contain alphabets and the length should be less than 6 characters)
2. Password(Password should contain alphabet and the symbol not less than 6)
3. E-mail id(should not contain any invalid and must follow the standard pattern)
4. Phone number(should contain 10 digits only)
Program:
Valreg.html
<html>
<head>
<script language=”javascript”>
Function validation()
{
var s1=f1.t1.value;
var s2=f1.t2.value;
var s3=f1.t3.value;
var s4=f1.t4.value;
var ex1=new RegExp(“^ *i a-z++$”);
10. var ex2=new RegExp(“^ *i A-Z0-9 + ,6-+$”);
var ex3=new RegExp(“^ *0-9+ ,10-$”);
var ex4=new RegExp(“^ *A-Z a-z].+[A-Z a-z 0-9] +.@[a-z]+.[a-z]{3}$”);
if(ex1.exec(s1)){}
else,alert(”invalid name”);-
if(ex2.exec(s2)){}
else,alert(“invalid password”);-
if(ex3.exec(s3)){}
else,alert(“invalid phone number”);-
if(ex4.exec(s4)){}
else,alert(“invalid e-mail id”);-
}
</script>
<body>
<form action=”ex.html name=”f1” method=”post” onsubmit=”validation()”>
Name :<input type=”text” size=”10 ” name=”t1”><br>
Password :<input type=”password” name=”t2 ”><br>
Phone number :<input type=”text” size=”10” name=”t3”><br>
E-mail :<input type=”text” size=”20 ”name=”t4”><tr><br>
<pre><input type=”submit” value=”submit” size=”20”>
<input type=”reset value=”reset” size=”20”></pre>
</form>
</body>
</html>
VALIDATION: Login Page
Aim: To write a java script to validate the following fields of login page.
1. User name(should contain alphabet, no less than 6)
2. Password(should not be less than 6 characters)
Program:
login.html
<html>
<head>
<script language=”javascript”>
function login()
{
var s1=f1.t1.value;
var s2=f1.t2.value;
var ex1=new RegExp(“^ *i a-z++$”);
var ex2=new RegExp(“^ *i A-Z0-9 + ,6-+$”);
if(ex1.exec(s1)){}
11. else,alert(”invalid name”);-
if(ex2.exec(s2)){}
else,alert(“invalid password”);-
}
</script>
<body>
<form action=”ex.html name=”f1” method=”post” onsubmit=”validation()”>
Name :<input type=”text” size=”10 ” name=”t1”><br>
Password :<input type=”password” name=”t2 ”><br>
<pre><input type=”submit” value=”submit” size=”20”>
<input type=”reset value=”reset” size=”20”></pre>
</form>
</body>
</html>
WEEK-4
Cascading Style Sheets
Aim:
To design a webpage using CSS(cascading style sheet) which includes the following
Use different font, style
In the style definition you define how each selector should work (font, clor, etc). Then in the
body of your pages, you refer to these selectors to activate the styles.
To design a page includes
Set a background image for both the page and single element on the page.
We can define the background image for the page like
BODY{background-image : Url (my image.gif);}
To design a page includes
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 HMTL.
To design a page includes
Define styles for links as
A:link
A:visited
A:active
A:hover
To design a page that includes work with layers.
To design a page includes
Add a customized cursor
Selector{cursor:value}
12. Program:
<html>
<head>
<title>stylesheet</title>
<style type=”text/css”>
B.headline {
color:red;
font-size:22px;
font-family:arial;
text-decoration:underline;
}
.xlink {cursor:crosshair;}
.hlink {cursor:help;}
body {background-image:url (“C:Documents and settingsPcMy Documents123.jpg”);
background-repeat:repeat;
}
a:link{text-decoration:none;}
a:visited{text-decoration:pink;}
a:active{text-decoration:blue;}
a:hover{ text-decoration:underline;color:red;}
</style>
</head>
<body>
<B>This is WT lab<B></br>
<a href=”MBA.html” class=”xlink”>crosslink</a>
<a href=”M.Tech.html” class=”hlink”>helpline</a>
<B class=”Headline”>Displaying Web Page</B>
Layer1 on <div
Style=”position:absolute”;font-size:50px;top:30;z-index:2>layer1
</div><br>
Layer2 on <div
Style=”position:absolute”;font-size:50px;color:red;left:5;top:25;z-index:2>layer2
</div>
</body>
</html>
13. Week -5
XML FILE
AIM:
To write an XML file which will display the book information which includes the following
1. Title of the book
2. Author Name
3. ISBN Number
4. Publisher Name
5. Edition Name
6. Price
Write a documenttype definition (DTD) to validate the above XML file
Program:
book.dtd
<!--Program:book.dtd-->
<?xml version=”1.0” encoding=”UTF-8”?>
<!ELEMENT booklist (book)*>
<!ELEMENT book (title,author,isbn,publisher,edition,price)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT isbn (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT edition (#PCDATA)>
<!ELEMENT price (#PCDATA)>
Program:
bookdtd.xml
<!--program:bookdtd.xml-->
<?xml version=”1.0”?>
<!DOCTYPE booklist SYSTEM “book:dtd”>
<booklist>
<book>
<title>xml bible</title>
<author>Winston</author>
<isbn>87499</isbn>
<publisher>wiely</publisher>
<edition>fifth edition</edition>
<price>$63</price>
</book>
<book>
<title>ai</title>
<author>s.Russel</author>
<isbn>87494</isbn>
<publisher>pinceton hall</publisher>
<edition>sixth edition</edition>
<price>$63</price>
17. Isbn>87422</isbn>
<publisher>bpb publications</publisher>
<edition>third edition</edition>
<price>$63</price>
</book>
<book>
<title>Html in 24 hours</title>
<author>sam peter</author>
<isbn>87492</isbn>
<publisher>sam publications</publisher>
<edition>fifth edition</edition>
<price>$50</price>
</book >
</booklist>
Week-6
Creating a New Bean:
To create a simple visual bean with area filled with a color.
The shape of the area depends on the property shape. If it isset 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.
Program:
Colors.java
package sunw.demo.colors;
import java.awt.*;
import java.awt.event*;
public class Colors extends Canwas
{
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 getRectangulat()
{
return rectangular;
18. }
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());
int b=(int)(255*Math.random());
return new Color(r,g,b);
}
public void paint(Grapics g)
{
Dimention d=getSize();
int h=d.height;
int w=d.width;
g.setColor(color);
if(rectangular)
{
g.fillRect(0,0,w-l,h-l);
}
else
{
g.fillOval(0,0,w-1,h-1);
}
}
}
WEEK-7
Installation Of Tomcat
Aim:
To write the installation procedure for Tomcat web server and APACHE and while installing use the
port number as 8080.
19. Week-8
User Authentication
AIM:
Assume four users user1, user2, user3 and users having passwords pwd1, pwd2, pwd3&pwd4
respectively. Write a servlet for doing the following:
1. Create a cookie and add these four user ids and passwords to this cookie.
2. Read the user id and passwords entered in the login form and authenticate with the
values (user id and passwords) available in the cookies.
If be is a valid user (i.e., username and password match) you should Welcome him
by name (user-name) else you should display “you are not an authenticated user.
Program:
cookies.html
<html>
<head>
</head>
<body bgcolor=”pink”>
<from action=”./cc” method=”get”>
<center><br><h3>WELCOME TO COOKIES WROLD!</h3><br>
Uname&ndsp&ndsp&ndsp&ndsp&ndsp:<input type=”text” name=”t1”<br><br><br>
Password:<input type=”password” name=”t2”><br><br><br>
<input type=”submit” value=”AddCookies”><br><br>
</form>
<form action=”./ch” method=”get”>
<center><br><h3>!@ Login Page @!<?h3><br>
Uname&ndsp&ndsp&ndsp&ndsp&ndsp:<input type=”text” name=”user”<br><br>
Password:<input type=”password” name=”pwd”><br><br>
<input type=”submit” value=”Login”><br><br>
</form>
</center>
</body>
<html>
Program:
AddCookie.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class AddCookie extends HttpServlet
{
Public void doGet(HttpServletRequest req,HttpServletResponse res)throws
IOException,ServletException
20. {
res.setContentType(“text/html”);
String name=req.getParameter(“t1”);
String value=req.getParameter(“t2”);
PrintWriter out=res.getWriter();
If((!value.equals(“”))&&(!name.equals(“”)))
{
Cookie c=new Cookie(name.value);
res.addCookie(c);
out.println(“<body bgcolor=cyan><p align=center>Cookie is Added:”);
out.println(“<a href=”./cc.html>To Add A New Cookie</a></p>”);
out.println(“<p align=center><a href=./view>View<?a><?p></body>”);
}
else
{
out.println(“Cookie is Not Executed”);
out.println(“<a href=./cc.html>Click Here to Add Cookie</a>”);
}
}
}
Program:
ValidCooki.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ValidCookie extends HttpServlet
{
Public void doGet(HttpServletRequest req,HttpServletResponse res)throws
IOException,ServletException
{
res.setContentType(“text/html”);
String name1=req.getParameter(“user”);
String value1=req.getParameter(“pwd”);
PrintWriter out=res.getWriter();
Cookie c[]=req.getCookie();
if(c!=null)
{
for(int j=0;j<c.length;j++)
{
if((c[j].getName()).equals(name1))
{
22. out.println(“</table></body></html>”);
out.close();
}
}
Program:
Web.xml
<web-app>
<servlet>
<servlet-name>c</servlet-name>
<servlet-class>AddCookies</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>c</servlet-name>
<url-pattern>/cc</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ch</servlet-name>
<servlet-class>ValidCookies</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ch</servlet-name>
<url-pattern>/ch</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>views</servlet-name>
<servlet-class>View</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>views</servlet-name>
<url-pattern>/view</url-pattern>
</servlet-mapping>
<web-app>
INIT Parameters
Aim: Use init parameters to the following:
Store the username and password in the web.xml and access them in the servlet by using the
following getInit Parameter ()
Initialization parameters are set in the deployment descriptor. To supply the data to the servlet
at the runtime of initialization of the servlet. We use initialization parameters. So, the servlet
can access this data during the runtime.
24. {
res.setContentType(“text/html):
PrintWriter out=res.getWriter();
out.println(“initParameters are”);
ServletConfig sc=getServletConfig();
Enumeration e=sc.getInitParameterNames();
out.println(“html><body bgcolon=cyan>”);
out.println(“<h1>welcome to init parameters</h1>”);
//out.println(“<form action=./init name=f1”);
//out.println(“<input type=”submit” value= to view init parametersclick>”);
out.println(“<boby><html>”);
While(e.hasMoreElements())
{
String name=(string)e.nextElement();
Out.println(“<br>”+sc.getinitParameter(name));
}
}
}
WEEK 9
Inserting values into Registration page
AIM: Install a database (my sql or oracle)
Create a table which should contain at least the following field:
Name, password, email_id, phone number. Practice “JDBC” connectivity. Write a java program
[servlet] jsp to connect to that database and extract data from the tables and display them.
Experiments with value various sql queries. Insert the details of the uses who register with the
website, wherever a new user click the submit button in the registration page.
Program:
Reg.html
<html>
<head>
<title>validation</title>
</head>
<form action=”./reg” method=”post”>
<body bgcolor=”magenta”>
<h1 align=”center”>registration form</h1>
<table border=”0”>
<tr>
<td>name:</td>
<td>input type=”test” name=”user” minlength=”6”>
</td>
26. out.println(e);
}
}
}
Program:
web.xml
<web-app>
<servlet>
<servlet-name>insert</servlet-name>
<servlet-class>RegServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>insert</servlet-name>
<url-pattern>/reg</url-pattern>
</servlet-mapping>
</web-app>
WEEK10
JSP Authentication
AIM: Write a Jsp which does the following job:
Insert the details of the 3 or 4 uses who register with the website (week9) by using registration
form. Authernticate the user when he submits the login form using the user name and password
from the database(similar to week8 instead of cookies).
Program
regis.jsp
<%@page import “java.io.*.java.sql.*”%>
<%
response.setContentType (“text/html”);
String name=request.getParameter (“name”);
String password=request.getParameter(“pass”);
String email=request.getParameter(“email”);
String phoneno=request.getParameter(‘phone”);
Class.forName(“sun.jdbc.odbc.jdbcodbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:student”,””,””);
Statement st=con.createStatement();
String str=”insert into reg values(‘”+name+”’,’”+password+’”,’”+email+”’,’”+phoneneo+”’)”;
St.executeUpdate(str);
String str1=”insert into login values(‘”+name+”’,’”+password+”’)”;
st.executeUpdate(str1);