You are on page 1of 45

WEB TECHNOLOGY LAB KCS-652

Year: 3rd Semester:6th

NITRA Technical Campus,


Sector– 23, Sanjay Nagar,
Ghaziabad – 201002

Submitted To: Submitted by:


Kishan Deewan Name: Ahsan Iqbal
CSE Department Roll No:1880210003
Branch-Year:B-tech.
CSE 3rd year

Roll No:1880210003 Page 1


INDEX

KCS-652 : Web Tech Lab

Sl.
No.
Program Topic Date Page Sign
No
1. Write an HTML program to design an entry
form of student details andsend it to store at
data base server like SQL ORACLE or MS
Access.
2. Write HTML/Java script to display your CV
in navigator, your institutewebsite and
Tutorial website for specific subject
3. Write program using java script for Web
Page to display browsersinformation.
4. Write a java applet to display the
Application Program screen i.eCalculator
and other.
5. Writing program in XML for creation of DTD.
Which specifies set of rules. Create a style
sheet in CSS/XSL & display the document in
internetexplorer.
6. Program to illustrate JDBC connectivity.
Program for maintaining database by sending
queries. Design and implement a simple servlet
bookquery with the help of JDBC & SQL.
Create MS Access Database, create on ODBC
link, Compile & execute JAVA JDVC Socket.
7. Install TOMCAT web server and APACHE.
Access the above developedstatic web pages
for books web site, using these servers by
putting the web pages developed.
8. Assume four user1,use2,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 password tothis cookies.2.
Read the user id and password entered in the
Login formand authenticate with the values
available in the cookies.

Roll No:1880210003 Page 2


9. Install a database (My sql 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 user
who register with the web site. whenever a
new user clicks the submit button in the
registration page.
10. 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.
11. Design and implement a simple shopping
cart example with session tracing API.

Roll No:1880210003 Page 3


1. Write an HTML program to design an entry form of student details andsend it to store
at data base server like SQL ORACLE or MS Access.
Program: -

HTML FILE :

<!DOCTYPE html>
<html>
<head>
<title>PHP insertion</title>
<link href="css/insert.css" rel="stylesheet">
</head>
<body>
<div class="maindiv">
<!--HTML Form -->
<div class="form_div">
<div class="title">
<h2>Insert Data In Database Using PHP.</h2>
</div>
<form action="insert.php" method="post">
<!-- Method can be set as POST for hiding values in URL-->
<h2>Form</h2>
<label>Name:</label>
<input class="input" name="name" type="text" value="">
<label>Email:</label>
<input class="input" name="email" type="text" value="">
<label>Contact:</label>
<input class="input" name="contact" type="text" value="">
<label>Address:</label>
<textarea cols="25" name="address" rows="5"></textarea><br>
<input class="submit" name="submit" type="submit" value="Insert">
</form>
</div>
</div>
</body>
</html>

Roll No:1880210003 Page 4


PHP file :

<?php
$connection = mysql_connect("localhost", "root", "");
Connection with Server
$db = mysql_select_db("colleges", $connection);
Server
if(isset($_POST['submit'])){
$name = $_POST['name'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$address = $_POST['address'];
if($name !=''||$email !=''){
//Insert Query of SQL
$query = mysql_query("insert into students(student_name, student_email,
student_contact, student_address) values ('$name', '$email', '$contact',
'$address')");
echo "<br/><br/><span>Data Inserted successfully...!!</span>";
}
else{
echo "<p>Insertion Failed <br/> Some Fields are Blank. .. !!</p>";
}
}
mysql_close($connection); // Closing Connection with Server
?>

Roll No:1880210003 Page 5


2. Write HTML/Java scripts to display your CV in navigator, your Institute website, Department
Website and Tutorial website for specific subject

<html>
<head>
<title>CV</title>
</head>
<body>
<div id="header">
<p id="name">Saurabh Kumar </p>
<a href="mailto:sk7619007@gmail.com" target="_blank"><p id="email">sk7619007@gmail.com</p></a>
<p id="contact">+91 1234567890</p>
</div>
<div class="left">
</div>
<div class="right">
<h3>CV Highlights</h3>
<p>
<ul>
<li>Currently going through XYZ company</li>
<li>Learnt basic Python, JavaScript, HTML, CSS </li>
<li>An independent, dedicated, efficient person. These attributes are proved through the series of courses I
have taken or I am taking as of now independently through online platforms.</li>
<li>Good Communication Skills, Presentation Skills, attitude towards leadership, authorisation and
delegation, conflict resolution and negotiation and a very good team worker.</li></ul>
</p>
<h3>Professional Experience</h3>
<h4 id="company-name">XYZ Pvt Ltd</h4>
<p id="job-title"><strong>Support Engineer (Technical Support)</strong></p>
<p id="job-responsibilities">Job Responsbilities</p>
<p>
<ul>
<li>Answer customer queries over email / ticketing system</li>
<li>Interact with our engineering team to get software issues and bugs resolved</li>
<li>Occasionally interact with customers over Skype or telephone</li>
<li>Contribute ideas to the team on how customers can be delighted</li></ul>
</p>
<h3>Educational Qualifications</h3>
<table border="1" width="200px" height="auto">
<tr id="heading">
<td>Qualification</td>
<td>Board</td>
<td>Percentage / Grades</td>
<td>Year</td>
</tr>
<tr>
<td>HighSchool</td>
<td>MDS</td>
<td>87%</td>
<td>2015</td>
</tr>
<tr>
Roll No:1880210024 Page 6
<td>12th</td>
<td>DAV</td>
<td>83%</td>
<td>2017</td>
</tr>
<tr>
<td>B.Tech CSE</td>
<td>NITRA Technical Campus</td>
<td>A Grade</td>
<td>2022</td>
</tr>
</table>
<h3>Independent Courses</h3>
<p>
<ul>
<li>
<span id="course-name">HTML & CSS for Beginners – Web Fundamentals</span>–
Codecademy.com</li>
<li>
<span id="course-name">Python – Fundamentals and Dynamic Programming </span> -
Codecademy.com</li>
<li>
<span id="course-name">JavaScript – Programming Basics, JS Apps and Build Games </span> -
Codecademy.com</li>
<li>
<span id="course-name">CS101: Introduction to Computer Science - Building a Web Crawler</span> -
Udacity.com</li>
<li>
<span id="course-name">CS50x – Introduction to Computer Science I</span>– edX.org & Harvard
University</li>
<li>
<span id="course-name">Calculus One</span> - Ohio State University & Coursera.org</li>
<li>
<span id="course-name">Introduction to Finance</span> - Coursera.org & University of Michigan</li>
</ul>
<h3>Technical Skills</h3>
<p>
<ul>
<li>
<span id="course-name">Operating Systems:</span> DOS, Windows 98, Windows 2000, Windows XP,
Windows NT, Windows Server 2003, Windows Vista, Windows 7, Macintosh Computers (OS X), Linux
(Ubuntu, Fedora)</li>
<li>
<span id="course-name">Application Software:</span> Office 97-2003; Office XP, Office 2007, Office for
Mac 2011, iWork ’09, Sage Accounting Software, Sage 50 (Accounting Software), Excel 2003/2007 for
Financial Modelling spreadsheets.</li>
<li>
<span id="course-name">Programming Skills:</span>HTML, CSS, Python, JavaScript, learning C and
C++</li></ul>
</p>

<h3>Personal Information:</h3>
Roll No:1880210024 Page 7
<p>
<ul>
<li>
A young, determined hard and smart working person. I believe in task based roles and complete
ownership of work.
<li>
<span id="course-name">Languages Known:</span>English, Hindi, Gujarati and Sindhi</li>
<li>
<span id="course-name">Hobbies:</span>I love reading Finance and IT related books / magazines, playing
Chess, swimming, listening music, surfing Internet, self-learning through e-courses.</li></ul>
</p>
<h3>Other Information</h3>
<p>
<ul>
<li>
<span id="course-name">Expected Salary:</span>As per company standards</li>
<li>
<span id="course-name">Area of Interest:</span>Software Development, Programming, Start-ups, Coding,
App Development, Technical Support, Support Engineer, Customer Happiness, Client service, Investment
Banking, Corporate Finance, Hedge Funds, Mergers & Acquisitions, Analyst, Equity Research, Business
Analysis</li>
<li>
<span id="course-name">Joining Date:</span>Immediate</li></ul>
</p>
<h3>Declaration</h3>
<p>
I hereby declare that the details furnished above are true and correct to the best of my knowledge and
belief.</p>
</div>
<div id="footer"></div>
</body>
</html>

Roll No:1880210024 Page 8


Output:-

Roll No:1880210024 Page 9


3. write program using java script for Web Page to display browsersinformation.
Program:-

<html>
<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()" />

</div>
</form>
</body>
</html>

Roll No:1880210024 Page 10


4. Write a java applet to display the Application Program screen i.e.Calculator
and other.
Program: -

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Calculator extends Applet implements ActionListener
{
TextField inp;
//Function to add features to the frame
public void init()
{
setBackground(Color.white);
setLayout(null);
int i;
inp = new TextField();
inp.setBounds(150,100,270,50);
this.add(inp);
Button button[] = new Button[10];
for(i=0;i<10;i++)
{
button[i] = new Button(String.valueOf(9-i));
button[i].setBounds(150+((i%3)*50),150+((i/3)*50),50,50);
this.add(button[i]);
button[i].addActionListener(this);
}
Button dec=new Button(".");
dec.setBounds(200,300,50,50);
this.add(dec);
dec.addActionListener(this);

Button clr=new Button("C");


clr.setBounds(250,300,50,50);
this.add(clr);
clr.addActionListener(this);

Button operator[] = new Button[5];


operator[0]=new Button("/");
operator[1]=new Button("*");
operator[2]=new Button("-");
operator[3]=new Button("+");
operator[4]=new Button("=");
for(i=0;i<4;i++)
{
operator[i].setBounds(300,150+(i*50),50,50);
this.add(operator[i]);
operator[i].addActionListener(this);
}
operator[4].setBounds(350,300,70,50);

Roll No:1880210024 Page 11


this.add(operator[4]);
operator[4].addActionListener(this);
}
String
num1="";String
op=""; String
num2="";
//Function to calculate the expression public
void actionPerformed(ActionEvent e)
{
String button = e.getActionCommand();
char ch = button.charAt(0);
if(ch>='0' && ch<='9'|| ch=='.')
{
if (!op.equals(""))
num2 = num2 + button;
else
num1 = num1 + button;
inp.setText(num1+op+num2);
}
else if(ch=='C')
{
num1 = op = num2 =
"";inp.setText("");
}
else if (ch =='=')
{
if(!num1.equals("") && !num2.equals(""))
{
double temp;
double n1=Double.parseDouble(num1);
double n2=Double.parseDouble(num2);
if(n2==0 && op.equals("/"))
{
inp.setText(num1+op+num2+" = Zero Division
Error");num1 = op = num2 = "";
}
else
{
if (op.equals("+"))
temp = n1 + n2;
else if (op.equals("-"))
temp = n1 - n2;
else if (op.equals("/"))
temp = n1/n2;
else
temp = n1*n2;
inp.setText(num1+op+num2+" = "+temp);
num1 = Double.toString(temp);
op = num2 = "";
}
}

Roll No:1880210024 Page 12


else
{
num1 = op = num2 =
"";inp.setText("");
}
}
else
{
if (op.equals("") || num2.equals(""))
op = button;
else
{
double temp;
double n1=Double.parseDouble(num1);
double n2=Double.parseDouble(num2);
if(n2==0 && op.equals("/"))
{
inp.setText(num1+op+num2+" = Zero Division
Error");num1 = op = num2 = "";
}
else
{
if (op.equals("+"))
temp = n1 + n2;
else if (op.equals("-"))
temp = n1 - n2;
else if (op.equals("/"))
temp = n1/n2;
else
temp = n1*n2;
num1 = Double.toString(temp);
op = button;
num2 = "";
}
}
inp.setText(num1+op+num2);
}
}
}
/*
<applet code = Calculator.class width=600 height=600>
</applet>
*/

Roll No:1880210024 Page 13


OUTPUT:-

5. Writing program in XML for creation of DTD. Which specifies set of rules. Create a
style sheet in CSS/XSL & display the document in internetexplorer.
Program in XML for creation of DTD
Displaying XML Documents Using CSS and XSL
1. Review-1 <ul><li>A well-formed document is one that conforms to the basic rules of XML.
</li></ul><ul><li>A valid document is well formed and is also validated against a DTD.
</li></ul><ul><li>The DTD specifies the grammatical structure of an XML document, thereby
allowing XML parsers to understand and interpret the document’s contents. </li></ul><ul><li>The
use of the SYSTEM keyword indicates to the parser that this is an external declaration, and that the set
of rules for this XML document can be found in a specified file. </li></ul><ul><li>EMPTY element-
content type specifies that the element has no child elements or character data. </li></ul>

2. Objectives <ul><li>Display an XML document in a browser </li></ul><ul><li>Identify the


style rules of CSS </li></ul><ul><li>Discuss different patterns and templates of XSL
</li></ul><ul><li>Apply different styles to XML elements using CSS and XSL
</li></ul><ul><li>Transform XML documents into HTML documents using XSLT
</li></ul><ul><li>Identify the differences between CSS and XSL </li></ul>.
4. Properties and Values <ul><li>A value of the CSS styling property may be a string, a numberwith
a unit, an integer, or a color value. </li></ul><ul><li>Values can be absolute or relative,
inheritable or non-inheritable. </li></ul>Example Absolute value P{margin-left:3cm;} A margin of 4
centimeter is created irrespective of the margin size. Example Relative value P{margin-left:10%}A
margin of 10% of the width of the page is created.
5. Color Values XML supports the following color values: Gray White Red Short form #888 #FFF
#F00 Decimal Integer rgb(136,136,136) rgb(255,255,255) rgb(255,0,0) Percentage
rgb(55%,55%,55%) rgb(100%,100%,100%) rgb(100%,0,

Roll No:1880210024 Page 14


1. Formatting the Text - 1 <ul><li>The CSS properties allow to specify the font in which an
element will be displayed, its size and color. </li></ul><ul><li><absolute-size> and
<relative-size> keywords are used with font properties </li></ul><absolute-size> xx-smallx-
small small medium <relative-size> large smaller.

2. Formatting the Text - 2 <ul><li>The different font properties that can be set are:
</li></ul>font-family font-size font-style font-weight font-variant Font.

3. Boxes -1 <ul><li>Blocks of text can be contained in a box. </li></ul><ul><li>The following


three properties apply to the boxes:
</li></ul><ul><ul><li>Margins
</li></ul></ul><ul><ul><li>Border </li></ul></ul><ul><ul><li>Padding
</li></ul></ul><ul><li>Padding is the distance between the contents of the adjacent box.
</li></ul><ul><li>Margin is the distance between the border and the outer edge of the
adjacent box, or between the border and its containing box. </li></ul>

4. Boxes -2 Border

5. Margins, Border and Padding <ul><li>The padding property is used to specify the distanceor
space between the border and its contents. </li></ul>Boxes margin-top margin-bottom
margin-left margin-right margin Margins Border border-top border-bottom border-left border-
right border padding-bottom padding-top padding-right padding-left padding Padding.

6. Controlling Layout <ul><li>The CSS layout properties can control the box on the screen.
</li></ul><ul><li>The boxes can be overlapped using the z-index property. </li></ul>A
paragraph that is two inches by one inch and with a scroll bar is displayed

7. XSL <ul><li>It is a style sheet application created specifically for XML.


</li></ul><ul><li>Features of XSL include: </li></ul><ul><ul><li>It provides a
transformation language (XSLT). </li></ul></ul><ul><ul><li>XSL can be used as a
formatting language. </li></ul></ul><ul><ul><li>XSL can be used to sort and filter.
</li></ul></ul><ul><ul><li>XSL can be used for pattern matching to find records.
</li></ul></ul>

8. XSL - 2 XML Document XSL HTML document displayed in the Web HTML CSS

9. Example for XSL <ul><li>The XSL style sheet code </li></ul><ul><li><html>


</li></ul><ul><li><head> </li></ul><ul><li><title>Icons In Cricket</title>
</li></ul><ul><li></head> </li></ul><ul><li><body> </li></ul><ul><li><h2>Icons In
Cricket</h2> </li></ul><ul><li><table border=&quot;2&quot; cellpadding=&quot;3&quot;>
</li></ul><ul><li><tr> </li></ul><ul><li><td>Player</td> <td>No. Of Catches</td>
</li></ul><ul><li><td>No. Of 100's</td> </li></ul><ul><li><td>No. Of 50's</td>
</li></ul><ul><li></tr> </li></ul><ul><li><xsl:for-each select=&quot;cricket/player&quot;
order-by =&quot;-catches&quot;> </li></ul><ul><li><tr>
</li></ul><ul><li><td><xsl:value- of select=&quot;name&quot;/></td>
</li></ul><ul><li><td><xsl:value-of select=&quot;no_50&quot;/></td>
</li></ul><ul><li><td><xsl:value-of
select=&quot;no_100&quot;/></td> </li></ul><ul><li><td><xsl:value-
of select=&quot;catches&quot;/></td> </li></ul><ul><li></tr> </li></ul><ul><li></xsl:for-
each> </li></ul><ul><li></table> </li></ul><ul><li></body>
</li></ul><ul><li></html>
</li></ul>.

10. Patterns <ul><li>The patterns supported in XSL are: </li></ul><ul><ul><li>Sorting


</li></ul></ul><ul><ul><li>Operators </li></ul></ul><ul><ul><li>Filtering
</li></ul></ul>Letters after sorting.

Roll No:1880210024 Page 15


11. Sorting <ul><li>The default sorting is ascending order. </li></ul><ul><li>The ‘-’ sign is usedto
sort in descending order. </li></ul>The chart is organized in the descending order of catches.

12. Operators XSL supports the se operators: / ./ // .// * @ = /*/name */* @* //name

13. Filtering and Logical Operators <ul><li>Filter operations can contain expression such as
Boolean expression, AND, OR, and NOT expressions </li></ul><ul><li>The different
logical operators that can be used are: </li></ul>Operator Description AND Logical and OR
Logical or NOT Negation = Equal != Not equal > Greater than < Less than >= Greaterthan or
equal to <= Less than or equal.

14. Templates <ul><li>Templates are the instructions in an XSL style sheet, which control the
conversion of element and its content. </li></ul><ul><li>It is represented by
<xsl:template>…</xsl:template> </li></ul><ul><li>It is applied with the <xsl:apply-
templates/> element </li></ul><ul><li>The template has two parts:
</li></ul><ul><ul><li>The matching part </li></ul></ul><ul><ul><li>The processing part
</li></ul></ul>Matching part Processing part.

15. Types of Matching Matching Matching by name Matching by ancestry Matching several
names Matching the root Wildcard matches Matching by ID Matching by attributes.

16. Handling Expressions <ul><li>XSL supports five types of Expressions. These are:
</li></ul><ul><ul><li>Node Sets </li></ul></ul><ul><ul><li>Booleans
</li></ul></ul><ul><ul><li>Strings </li></ul></ul><ul><ul><li>Numbers
</li></ul></ul><ul><ul><li>Result Tree Fragments </li></ul></ul>.

17. Switching Styles Data Islands 1 XML document Data Islands 2 Data Islands 3 XML
document with XSL style sheet 1 XML document with XSL style sheet 2 XML document
with XSL style sheet 3.

18. xsl:import and xsl:include <ul><li>Style sheets created by other developers can be imported
using the xsl:import </li></ul><ul><li>The syntax for importing style sheets is:
</li></ul><ul><li><xsl:import href= ‘another stylesheet.xsl’/>
</li></ul><ul><li><xsl:import href= ‘another stylesheet1.xsl’/> </li></ul><ul><li>All the
different style sheets imported are arranged in an import tree. </li></ul><ul><li>A new node
is created in the import tree when a style sheet is imported </li></ul>

6. Program to illustrate JDBC connectivity. Program for maintaining database by


sending queries. Design and implement a simple servlet bookquery with the help of
JDBC & SQL. Create MS Access Database, createon ODBC link, Compile & execute
JAVA JDVC Socket.
Program:-

//STEP 1. Import required packagesimport java.sql.*;

public class FirstExample {


// JDBC driver name and database URL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";static final String DB_URL =
"jdbc:mysql://localhost/EMP";

Roll No:1880210024 Page 16


// Database credentials
static final String USER = "username";static final
String PASS = "password";

public static void main(String[] args) {Connection conn


= null;
Statement stmt = null;try{
//STEP 2: Register JDBC driver Class.forName("com.mysql.jdbc.Driver");

//STEP 3: Open a connection System.out.println("Connecting to


database..."); conn =
DriverManager.getConnection(DB_URL,USER,PASS);

//STEP 4: Execute a query System.out.println("Creating


statement...");stmt = conn.createStatement();
String sql;
sql = "SELECT id, first, last, age FROM Employees";ResultSet rs =
stmt.executeQuery(sql);

//STEP 5: Extract data from result setwhile(rs.next()){


//Retrieve by column name int id =
rs.getInt("id"); int age =
rs.getInt("age");
String first = rs.getString("first");String last =
rs.getString("last");

//Display values System.out.print("ID: " + id);


System.out.print(", Age: " + age); System.out.print(",
First: " + first);System.out.println(", Last: " + last);
}
//STEP 6: Clean-up environmentrs.close();
stmt.close();
conn.close();
}catch(SQLException se){
//Handle errors for JDBC
se.printStackTrace();
}catch(Exception e){
//Handle errors for Class.forName
e.printStackTrace();
}finally{
//finally block used to close resourcestry{
if(stmt!=null)
stmt.close();
}catch(SQLException se2){

Roll No:1880210024 Page 17


}// nothing we can dotry{
if(conn!=null)
conn.close();
}catch(SQLException se){
se.printStackTrace();
}//end finally try
}//end try System.out.println("Goodbye!");
}//end main
}//end FirstExample

First example :- C:\>java FirstExampleConnecting to


database...
Creating statement...
ID: 100, Age: 18, First: saurabh, Last: kumar
ID: 101, Age: 25, First: abhay, Last: chaudhary
ID: 102, Age: 30, First: ahsan, Last: iqbal
ID: 103, Age: 28, First: santosh, Last: pandeyl
C:\>

7. Install TOMCAT web server and APACHE. Access the above developed static
web pages for books web site, using these servers byputting the web pages
developed.
Installation of TOMCAT web server
Eclipse is a very powerful development environment for Java. Mainly for Web
Developmentproject you need Web Server. Apache Tomcat is the best production ready web
container

Roll No:1880210024 Page 18


By default when you download Eclipse IDE, it doesn’t come with Tomcat install with it. Inthis
tutorial we will go over all detailed steps to configure Apache Tomcat successfully
in Eclipse environment.

Have any of below questions? Then you are at right place.

 Configuration of the Eclipse Workspace and Apache Tomcat

 How can I add Tomcat server to eclipse?

 Installing Apache Tomcat Server – Eclipse

 Tutorial: Configuring and Using Apache Tomcat 9 with Eclipse

 Apache Tomcat Eclipse Integration Guide & Plugin

 how to add apache tomcat server in eclipse Photon?

Step-1

Download Apache Tomcat from this link. I’m using version 9.0.10.

Roll No:1880210024 Page 19


Step-3

 Open Eclipse Environment

 Click on ServersTab

 Click on No servers are available. Click this link to create a new

server...

 Click Tomcat v9.0 Serverand Next

Roll No:1880210024 Page 20


Roll No:1880210024 Page 21
Step-4

Roll No:1880210024 Page 22


8 Assume four user1,use2,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 password to thiscookies.2. Read the user id and password
entered in the Login form and authenticate with the values available in the cookies.

Program:-
First, create a database and table for User using the following SQL scripts:

CREATE TABLE `users` (


`uname` varchar(10) NOT NULL,
`password` varchar(10) NOT NULL,
`email` varchar(50) default NULL,
`registeredon` date default NULL,PRIMARY KEY (`uname`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Database.java
package com.bari.util;
import java.sql.Connection;
import java.sql.DriverManager;
public class Database {
public static Connection getConnection() {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection
("jdbc:mysql://localhost:3306/dbname","root","dbpass");
return con;
}
catch(Exception ex) {
System.out.println("Database.getConnection() Error -->" + ex.getMessage());
return null;
}
}
public static void close(Connection con) {
try {
con.close();
}
catch(Exception ex) {

Roll No:1880210024 Page 23


}
}
}

This (addUser) Method is used to insert the USER NAME, PASSWORD, EMAIL,
REGISTRATION

public void addUser(User user) {try {


PreparedStatement preparedStatement =
connection.prepareStatement("insert into users(uname, password, email, registeredon)
values (?, ?, ?, ? )");
// Parameters start with 1 preparedStatement.setString(1,
user.getUname());preparedStatement.setString(2,
user.getPassword());
preparedStatement.setString(3,user.getEmail());
preparedStatement.setDate(4, new
java.sql.Date(user.getRegisteredon().getTime()));
preparedStatement.executeUpdate();

} catch (SQLException e) {e.printStackTrace();


}
}

This deleteUser method is user to delete the user.

public void deleteUser(String userId) {try {


PreparedStatement preparedStatement =
connection.prepareStatement("delete from users whereuname=?");
// Parameters start with 1 preparedStatement.setString(1,
userId);preparedStatement.executeUpdate();

} catch (SQLException e) {e.printStackTrace();


}
}

Roll No:1880210024 Page 24


This (updateUser)method is used to update the user.

public void updateUser(User user) {try {


PreparedStatement preparedStatement =
connection.prepareStatement("update users set password=?,email=?, registeredon=?"
+ "where uname=?");
// Parameters start with 1
System.out.println(new
java.sql.Date(user.getRegisteredon().getTime()));preparedStatement.setString(1,
user.getPassword());
preparedStatement.setString(2, user.getEmail());
preparedStatement.setDate(3, new
java.sql.Date(user.getRegisteredon().getTime())); preparedStatement.setString(4,
user.getUname());preparedStatement.executeUpdate();

} catch (SQLException e) {e.printStackTrace();


}
}

Roll No:1880210024 Page 25


Roll No:1880210024 Page 26
9. Install a database (My sql or oracle). Create a table which should containat 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 user who register with the web site. whenever a new
user clicks the submit button in the registration page.
The MySQL™ software delivers a very fast, multithreaded, multi-user, and robust SQL
(Structured Query Language) database server. MySQL Server is intended for mission-critical,
heavy-load production systems as well as for embedding into mass-deployed software. Oracle is a
registered trademark of Oracle Corporation and/or its affiliates. MySQL is a trademark of Oracle
Corporationand/or its affiliates, and shall not be used by Customer without Oracle's express written
authorization. Other names may be trademarks of their respective owners.

Installation
Installing MySQL on your Windows server is as simple as downloading an MSI
Installer package and clicking through a few options.
1. Download the MySQL Installer from dev.mysql.com . The two download options are a
web-community version and a full version. The web-community version will only download
the server, by default, but you can select other applications (like Workbench) as desired. The
full installer will download the server and all the recommended additional applications.
(You’ll also be asked to create a user account,
but you skip this part by scrolling down to the bottom and clicking “No thanks, just
start my download ”.)

Roll No:1880210024 Page 27


Roll No:1880210024 Page 28
Table which should contain at least the following fields: name, password,email-id,
phone number
CREATE TABLE employe(user_name INT,userpassword VARCHAR(200),email
VARCHAR(200),phone FLOAT);

JSP to connect to that database and extract data from the tables anddisplay
them

1. import java.sql.*;
2. class MysqlCon{
3. public static void main(String args[]){
4. try{
5. Class.forName("com.mysql.jdbc.Driver");
6. Connection con=DriverManager.getConnection(
7. "jdbc:mysql://localhost:3306/sonoo","root","root");
8. //here sonoo is database name, root is username and password
9. Statement stmt=con.createStatement();
10. ResultSet rs=stmt.executeQuery("select * from emp");
11. while(rs.next())
12. System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
13. con.close();
14. }catch(Exception e){ System.out.println(e);}

Roll No:1880210024 Page 29


10. 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 hesubmits the login form using
the user name and password from the database.

Registration Form in JSP


1. Registration Form in JSP
2. Example of Registration Form in JSP

For creating registration form, you must have a table in the database. You can write the database logic
in JSP file, but separating it from the JSP page is better approach.Here, we are going to use DAO,
Factory Method, DTO and Singletion design patterns. There are many files:

o index.jsp for getting the values from the user


o User.java, a bean class that have properties and setter and getter methods.
o process.jsp, a jsp file that processes the request and calls the methods
o Provider.java, an interface that contains many constants like DRIVER_CLASS,
CONNECTION_URL, USERNAME and PASSWORD
o ConnectionProvider.java, a class that returns an object of Connection. It usesthe Singleton and
factory method design pattern.
o RegisterDao.java, a DAO class that is responsible to get access to the database

Example of Registration Form in JSP

1. <form action="process.jsp">
2. <input type="text" name="uname" value="Name..." onclick="this.value=''"/
><br/>
3. <input type="text" name="uemail" value="Email ID..." onclick="this.value='
'"/><br/>
4. <input type="password" name="upass" value="Password..." onclick="this.v
alue=''"/><br/>
5. <input type="submit" value="register"/>
6. </form>

Roll No:1880210024 Page 30


RegisterDao.java

This class inserts the values of the bean component into the database.

1. package bean;
2.
3. import java.sql.*;
4.
5. public class RegisterDao {
6.
public static int register(User u){
7.
int status=0;
8.
try{
9.
10. Connection con=ConnectionProvider.getCon();
11. PreparedStatement ps=con.prepareStatement("insert into user432 values(?,?
,?)");
12. ps.setString(1,u.getUname());
13. ps.setString(2,u.getUemail());
14. ps.setString(3,u.getUpass());15.
16. status=ps.executeUpdate();
17. }catch(Exception e){}18.

19.return status;

ConnectionProvider.java

This class is responsible to return the object of Connection. Here, driver class isloaded
only once and connection object gets memory only once.

1. package bean;
2. import java.sql.*;
3. import static bean.Provider.*;
4.
5. public class ConnectionProvider {

Roll No:1880210024 Page 31


6. private static Connection con=null;
7. static{
8. try{
9. Class.forName(DRIVER);
10. con=DriverManager.getConnection(CONNECTION_URL,USERNAME,PASSWOR
D);
11. }catch(Exception e){}
12.}13.
14. public static Connection getCon(){
15. return con;

Provider.java

This interface contains four constants that can vary from database to database.

1. package bean;
2.
3. public interface Provider {
4. String DRIVER="oracle.jdbc.driver.OracleDriver";
5. String CONNECTION_URL="jdbc:oracle:thin:@localhost:1521:xe";
6. String USERNAME="system";
7.
String PASSWORD="oracle";
8.
9. }

User.java

It is the bean class that have 3 properties uname, uemail and upass with its setter and getter m

1. package bean;
2. public class User {
3. private String uname,upass,uemail;
4. public String getUname() {
5. return uname;
6. public void setUname(String uname) {
7. this.uname = uname;
8. public String getUpass() {

Roll No:1880210024 Page 32


10. public void setUpass(String upass) {
11. this.upass = upass;
12. public String getUemail() {
13. return uemail;
14. public void setUemail(String uemail) {
15. this.uemail = uemail;
process.jsp

This jsp file contains all the incoming values to an object of bean class which ispassed
as an argument in the register method of the RegisterDao class.

1. <%@page import="bean.RegisterDao"%>
2. <jsp:useBean id="obj" class="bean.User"/>
3. <jsp:setProperty property="*" name="obj"/>4. <%
5. int status=RegisterDao.register(obj);
6. if(status>0)
7. out.print("You are successfully registered");8. %>

we are using the Oracle10g database to connect with the database. Let's firstcreate
the table in the Oracle database:

19.CREATE TABLE "USER432"


20. ( "NAME" VARCHAR2(4000),
21. "EMAIL" VARCHAR2(4000),
22. "PASS" VARCHAR2(4000)
23. )

Roll No:1880210024 Page 33


11.Design and implement a simple shopping cart example with sessiontracing
API.
Web Display :-

Program:-

<!DOCTYPE html>
<!-- saved from url=(0030)http://technobita.appspot.com/ -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Global site tag (gtag.js) - Google Analytics -->

Roll No:1880210024 Page 34


<script src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/osd.js.download"></script><script src="./Technobita-Full specifications and reviews of
mobile phones and laptops_files/f.txt"></script><script src="./Technobita-Full specifications and
reviews of mobile phones and laptops_files/f(1).txt" id="google_shimpl"></script><script
type="text/javascript" async="" src="./Technobita-Full specifications and reviews of mobile phones
and laptops_files/analytics.js.download"></script><script async="" src="./Technobita-Full
specifications and reviews of mobile phones and laptops_files/js"></script>
<script>
window.dataLayer = window.dataLayer || [];

function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());

gtag('config', 'UA-141737823-1');
</script>
<!-- Adsense script -->
<script async="" src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/f(2).txt"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-3537783124277522",
enable_page_level_ads: true
});
</script>

<meta name="theme-color" content="#232F3F">


<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google-site-verification"
content="yj1kbtjY92yCsuDv1md1-pYGAbsEjy6ItAksM3yF8xU">
<meta name="keywords" content="Technobita, Technobita.appspot, Shashank Yenurkar,
shashank, yenurkar, uyshashank">
<title>Technobita-Full specifications and reviews of mobile phones and laptops</title>
<!--Favicon-->
<link rel="icon" href="http://technobita.appspot.com/images/logo/favicon_technobita.ico"
sizes="16x16" type="image/png">
<!--Bootstrap CSS links-->
<link rel="stylesheet" type="text/css" href="./Technobita-Full specifications and reviews of mobile
phones and laptops_files/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="./Technobita-Full specifications and reviews of mobile
phones and laptops_files/styles.css">
<!--Google Fonts-->
<link href="./Technobita-Full specifications and reviews of mobile phones and laptops_files/css"
rel="stylesheet">
<!--Font Awesome-->
<link rel="stylesheet" href="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/all.css" integrity="sha384-
hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ"
crossorigin="anonymous">

Roll No:1880210024 Page 35


<script src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/script.js.download"></script><meta http-equiv="origin-trial"
content="A+b/H0b8RPXNaJgaNFpO0YOFuGK6myDQXlwnJB3SwzvNMfcndat4DZYMrP4ClJIzY
Wo3/yP
2S+8FTZ/lpqbPAAEAAABueyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo
0NDMiL
CJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzVGhpcmRQYXJ0e
SI6dHJ1ZX 0="><meta http-equiv="origin-trial"
content="A9ZgbRtm4pU3oZiuNzOsKcC8ppFSZdcjP2qYcdQrFKVzkmiWH1kdYY1Mi9x7G8+PS8
HV9Ha9
Cz0gaMdKsiVZIgMAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMi
LCJmZW
F0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlL
CJpc1RoaXJkUGFydHkiOnRydWV9"><meta http-equiv="origin-trial"
content="AxL6oBxcpn5rQDPKSAs+d0oxNyJYq2/4esBUh3Yx5z8QfcLu+AU8iFCXYRcr/CEEfDnk
xxLTsvXP
JFQBxHfvkgMAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0N
DMiLCJm
ZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cn
VlLCJpc1R oaXJkUGFydHkiOnRydWV9"><meta http-equiv="origin-trial"
content="A9KPtG5kl3oLTk21xqynDPGQ5t18bSOpwt0w6kGa6dEWbuwjpffmdUpR3W+faZDubGT
+KIk
2do0BX2ca16x8qAcAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNv
bTo0ND
MiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWl
uIjp0cnVlL CJpc1RoaXJkUGFydHkiOnRydWV9"><meta http-equiv="origin-trial"
content="A3HucHUo1oW9s+9kIKz8mLkbcmdaj5lxt3eiIMp1Nh49dkkBlg1Fhg4Fd/r0vL69mRRA36
YutI
9P/lJUfL8csQoAAACFeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJ
mZWF0d
XJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1N1YmRvbW
FpbiI6dH J1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial"
content="A0OysezhLoCRYomumeYlubLurZTCmsjTb087OvtCy95jNM65cfEsbajrJnhaGwiTxhz38Z
Zbm+
UhUwQuXfVPTg0AAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbT
o0NDMi
LCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc
1N1YmRv bWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-
trial"
content="AxoOxdZQmIoA1WeAPDixRAeWDdgs7ZtVFfH2y19ziTgD1iaHE5ZGz2UdSjubkWvob9
C5PrjUf
kWi4ZSLgWk3Xg8AAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo
0NDMiLC
JmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1N
1YmRvb WFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial"
content="A7+rMYR5onPnACrz+niKSeFdH3xw1IyHo2AZSHmxrofRk9w4HcQPMYcpBUKu6OQ6
zsdxf4m
/vqa6tG6Na4OLpAQAAAB4eyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDM
iLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjI2MjIwNzk5LCJpc1RoaXJkU
GFydHkiOnRydWV9"><meta http-equiv="origin-trial"
content="AwfG8hAcHnPa/kJ1Co0EvG/K0F9l1s2JZGiDLt2mhC3QI5Fh4qmsmSwrWObZFbRC9ieDaSLU
6lHRxhGUF/i9sgoAAACBeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF

Roll No:1880210024 Page 36


0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJ
pc1RoaXJkUGFydHkiOnRydWV9"><meta http-equiv="origin-trial"
content="AwQ7dCmHkvR6FuOFxAuNnktYSQrGbL4dF+eBkrwNLALc69Wr//PnO1yzns3pjUoCaYbKHtV
cnng2hU+8OUm0PAYAAACHeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0
NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tY
WluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"><meta http-equiv="origin-trial"
content="AysVDPGQTLD/Scn78x4mLwB1tMfje5jwUpAAzGRpWsr1NzoN7MTFhT3ClmImi2svDZA7V6n
WGIV8YTPsSRTe0wYAAACHeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0ND
MiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWl
uIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9">
<style>

Roll No:1880210024 Page 37


#dropdownMenu:hover {
border-bottom: 0;
}

.dropdown-menu a:hover {
background-color: powderblue;
}
</style>

<link rel="preload" href="./Technobita-Full specifications and reviews of mobile phones and


laptops_files/f(3).txt" as="script"><script type="text/javascript" src="./Technobita-Full specifications
and reviews of mobile phones and laptops_files/f(3).txt"></script><link rel="preload"
href="./Technobita-Full specifications and reviews of mobile phones and laptops_files/f(4).txt"
as="script"><script type="text/javascript" src="./Technobita-Full specifications and reviews of
mobile phones and laptops_files/f(4).txt"></script></head><iframe id="google_esf"
name="google_esf" src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/zrt_lookup.html" style="display: none;"></iframe>
<body>
<section id="baap" class="sticky-top">
<!--Primary Navigation bar-->
<nav class="navbar navbar-expand-md navbar-light mainNavbar">
<div class="container">
<!--logo-->
<a href="http://technobita.appspot.com/" class="navbar-brand">
<img src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/logo_yellow.png" alt="Technobita Logo" class="img-fluid logo">
</a>

<!--Search Bar-->

<form action="http://technobita.appspot.com/q" method="get" name="myFormDesktop"


class="w-50 d-none d-lg-flex" onsubmit="return validateForm()">
<div class="input-group">
<input type="text" name="s" autocomplete="off" class="border-0 form-control
search-field" placeholder="Search for Products...">
<div class="input-group-append">

<a class="btn text-white border-0 input-group-text" id="search-btn">


<i class="fas fa-search"></i>
</a>
</div>
</div>
</form>

Roll No:1880210024 Page 38


<!--Collapsible menu-->
<div class="collapse text-center navbar-collapse text-white justify-content-end"
id="content">
<ul class="navbar-nav mx-3" id="menu-item">
<li class="nav-item">
<a href="http://technobita.appspot.com/" class="nav-link">Home</a>
</li>

<li class="nav-item">
<a href="http://technobita.appspot.com/login" class="nav-link">Login</a>
</li>
<li class="nav-item">
<a href="http://technobita.appspot.com/signup" class="nav-link">Signup</a>
</li>

<li class="nav-item d-none d-md-flex d-lg-none">


<a href="http://technobita.appspot.com/" class="nav-link"> <i class="fas fa-
search"></i> </a>
</li>
</ul>
</div>
</div>
</nav>

<section class="sticky-top">
<nav class="navbar navbar-light secondaryNavbar d-md-none" id="secondaryNavbar">
<div class="container-fluid my-0 justify-content-center">
<ul class="list-inline my-0">
<li class="list-inline-item">
<a href="http://technobita.appspot.com/">Home</a>
</li>
<li class="list-inline-item">
<a href="http://technobita.appspot.com/">All Brands</a>
</li>

<li class="list-inline-item">
<a href="http://technobita.appspot.com/login">Login</a>
</li>
<li class="list-inline-item">
<a href="http://technobita.appspot.com/signup">Signup</a>
</li>

<li class="list-inline-item">
<span href="" class="text-white" onclick="openSearch()" id="searchIcon">
<iclass="fas fa-search"></i></span>
</li>

Roll No:1880210024 Page 39


</ul>
</div>
</nav>
<!--Search Bar for small screens-->
<nav class="navbar navbar-light d-md-none" id="searchBarNav">
<form method="get" name="myFormMobile" class="w-100" onsubmit="return
validateForm()">
<div class="input-group">
<input type="text" name="s" autocomplete="off" class="border-0 form-control search-
field" placeholder="Search for Products...">
<div class="input-group-append">
<a class="btn text-white border-0 input-group-text" id="search-btn">
<i class="fas fa-search"></i>
</a>
</div>
</div>
</form>
<div id="warningSmall" class="alert alert-primary fade show my-auto" role="alert">
<strong>Search Field Empty</strong>
</div>
</nav>
</section>
<!--Carousel Slideshow for >md screens--
>

<section class="hero container-fluid d-none d-md-flex">


<div id="demo" class="carousel slide" data-ride="carousel">

<!-- Indicators -->


<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class=""></li>
<li data-target="#demo" data-slide-to="1" class=""></li>
<li data-target="#demo" data-slide-to="2" class="active"></li>
</ul>

<!-- The slideshow -->


<div class="carousel-inner">
<div class="carousel-item">
<img src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/1.jpg" class="img-fluid" alt=" ">
</div>
<div class="carousel-item">
<img src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/2.jpg" class="img-fluid" alt=" ">
</div>
<div class="carousel-item active">
<img src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/3.jpg" class="img-fluid" alt=" ">
</div>
</div>

Roll No:1880210024 Page 40


<!-- Left and right controls -->
<a class="carousel-control-prev" href="http://technobita.appspot.com/#demo" data-
slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="http://technobita.appspot.com/#demo" data-
slide="next">
<span class="carousel-control-next-icon"></span>
</a>

</div>
</section>

<section class="container mt-3">


<div class="row mx-0 ml-4">

<div class="head mt-4 border-bottom">


<div class="section-title row">
<h5 class="col-8 my-
2">Recommended
</h5>
</div>
</div>

<div class="row mb-3">

<div class="body col-sm">

<div class="row">

<div class="product col text-center mt-3">


<a href="http://technobita.appspot.com/find/asus/asus_x507ua_core_i5"
class="product-links">

<div class="" style="min-height: 80px;max-height: 90px;">


<img src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/1(17).jpg" alt="" class="img-fluid product-img" style="max-height: inherit;min-
height:inherit;"><!-- here comes the img --->
</div>
<div class="product-overview mt-2" style="min-height: 90px; max-height: 90px;">
<div name="rating" class="badge badge-warning text-white rating">
4.2 <i class="fas fa-star"></i>
</div>
<div name="product-title">
ASUS Laptop X507UA Core
i5
</div>
<div name="memory">
8 GB SDRAM

Roll No:1880210024 Page 41


</div>
<div name="storage">
1 TB HDD
</div>

</div>
</a>
</div>

</div>

<div class="row">

<div class="product col text-center mt-3">


<a href="http://technobita.appspot.com/find/asus/zenbook_s_ux391ua_core_i7"
class="product-links">

<div class="" style="min-height: 80px;max-height: 90px;">


<img src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/1(19).jpg" alt="" class="img-fluid product-img" style="max-height: inherit;min-
height:inherit;"><!-- here comes the img --->
</div>
<div class="product-overview mt-2" style="min-height: 90px; max-height: 90px;">
<div name="rating" class="badge badge-warning text-white rating">
4.6 <i class="fas fa-star"></i>
</div>
<div name="product-title">
ASUS ZenBook S
UX391UA
</div>
<div name="memory">
16 GB
</div>
<div name="storage">
512 GB SSD
</div>

</div>
</a>
</div>

</div>

</div>

<div class="body col-sm">

<div class="row">

Roll No:1880210024 Page 42


<div class="product col text-center mt-3">
<a href="http://technobita.appspot.com/find/hp/omen_x_core_i7" class="product-
links"
>

<div class="" style="min-height: 80px;max-height: 90px;">


<img src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/1(21).jpg" alt="" class="img-fluid product-img" style="max-height: inherit;min-
height:inherit;"><!-- here comes the img --->
</div>
<div class="product-overview mt-2" style="min-height: 90px; max-height: 90px;">
<div name="rating" class="badge badge-warning text-white rating">
4.4 <i class="fas fa-star"></i>
</div>
<div name="product-title">
HP OMEN X Core i7
</div>
<div name="memory">
32 GB DDR4
</div>
<div name="storage">
1 TB SSD
</div>

</div>
</a>
</div>

</div>

</div>

</div>

</section>

<footer class="footer w-100 py-3" style="background-color:black;">


<div class="text-center text-white">© 2019 TechNobita.com</div>
</footer>

<!--Script written by me-->


<!--Form Validation and search bar hidder for small screens-->
<script>
var searchBarNav = document.getElementById('searchBarNav');
var secondaryNavbar = document.getElementById('secondaryNavbar');
var searchField = document.querySelectorAll('.searchField');
var searchBtn = document.querySelectorAll('.search-btn');

function openSearch() {
if (searchBarNav.style.display === "block") {

Roll No:1880210024 Page 43


searchBarNav.style.display = "none";
secondaryNavbar.classList.add('secondaryNavbar');
secondaryNavbar.classList.remove('secondaryNavbarToggle');
} else {
searchBarNav.style.display = "block";
secondaryNavbar.classList.add('secondaryNavbarToggle');
secondaryNavbar.classList.remove('secondaryNavbar');
}
}

function validateForm() {
var mobileSearch = document.forms["myFormMobile"]["s"].value;
var desktopSearch = document.forms["myFormDesktop"]["s"].value;
var warningSmall = document.getElementById('warningSmall');

if (searchBarNav.style.display === "block")


{if (mobileSearch == "") {
warningSmall.style.display =
"block";return false;
}
} else {
if (desktopSearch == "") {
alert('Search Feild Empty')
return false;
}
}
}
</script>
<!--Bootstrap Js links-->
<script src="./Technobita-Full specifications and reviews of mobile phones and laptops_files/jquery-
3.3.1.slim.min.js.download" integrity="sha384-
q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/popper.min.js.download" integrity="sha384-
ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/bootstrap.min.js.download" integrity="sha384-
ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>

</section><ins class="adsbygoogle adsbygoogle-noablate" data-adsbygoogle-status="done"


style="display: none !important;" data-ad-status="unfilled"><ins id="aswift_0_expand"
style="display:inline-
table;border:none;height:0px;margin:0;padding:0;position:relative;visibility:visible;width:0px;backgr
ound-color:transparent;" tabindex="0" title="Advertisement" aria-label="Advertisement"><ins
id="aswift_0_anchor"
style="display:block;border:none;height:0px;margin:0;padding:0;position:relative;visibility:visible;w
idth:0px;background-color:transparent;"><iframe id="aswift_0" name="aswift_0"
style="left:0;position:absolute;top:0;border:0;width:undefinedpx;height:undefinedpx;"

Roll No:1880210024 Page 44


sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin
allow- scripts allow-top-navigation-by-user-activation" frameborder="0" src="./Technobita-
Full specifications and reviews of mobile phones and laptops_files/ads.html"
marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true"
scrolling="no" allowfullscreen="true" data-google-container-id="a!1" data-load-
complete="true"></iframe></ins></ins></ins><iframe
id="google_osd_static_frame_4428480500821" name="google_osd_static_frame"
style="display: none; width: 0px; height: 0px;" src="./Technobita-Full specifications and
reviews of mobile phones and laptops_files/saved_resource.html"></iframe><iframe
src="./Technobita-Full specifications and reviews of mobile phones and
laptops_files/aframe.html" width="0" height="0" style="display:
none;"></iframe></body></html>

Roll No:1880210024 Page 45

You might also like