0% found this document useful (0 votes)
19 views

Akash Dixit

The document describes a program that writes XML code to define a DTD for books. It includes XML code for books with titles, authors, publishers, editions and prices. It also references a CSS stylesheet to display the XML document in a web browser.

Uploaded by

Akshay Teotia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Akash Dixit

The document describes a program that writes XML code to define a DTD for books. It includes XML code for books with titles, authors, publishers, editions and prices. It also references a CSS stylesheet to display the XML document in a web browser.

Uploaded by

Akshay Teotia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

PROGRAM NO:- 01

Write HTML/Java scripts to display your CV in navigator, your Institute website,


Department Website and Tutorial website for specific subjects.

<!DOCTYPE HTML>
<html>
<body style="background-color:white;">
<div style="position:absolute;top:90px;left:800px;color:red;">
</div>
<div style="padding-left:0px;margin-top:10px; ">
<p style="font-size:20pt; text-align: right"><a
href="https://www.sanskarcollege.ac.in/">
<center>Sanskar College Of Engineering & Technology</center>
</a></p>
<h1 style="font-size:30pt; text-align:center"><i><span
style="color:Black;"><u>CV</u></i></h1>
<div style="padding-left: 150px;margin-top:3px; ">
<h1style="font-size:20pt;"><i><span style="color:black;">Akash Dixit
</span></i></h1>
<h4>9557792651</br>
[email protected]</br>New Delhi</br>
Pin Code-110001</h4>
</div>
<div id="menu" style="background-color:white;width:150px;
height:700px;float:left;">
</div>
<div id="content" style="background-color:white;
float:left;width:700px;height:1800px;">
<h1 style="font-size:20pt;">Objective</h1>
<p style="font-size: 15pt; font-family:Bell MT">A motivated individual with
in-depth
knowledge of
languages and development tools, </br>
seeking a position in a growth-oriented company where I can use my skills to
the</br> advantage of the company while having the scope to develop my own
skills.</p>
<h1 style="font-size:25pt;">EDUCATION AND QUALIIFICATIONS:</h1>
<table>
<tr>
<th>Qualification</th>
<th>Maximum Marks</th>
<th>Obtained Marks</th>
<th>Division</th>
<th>Institution</th>
<th>Board/University</th>
</tr <tr>
<td>B.Tech in progress</td>
<td> </td>
<td> </td>
<td>None</td>
<td>Sanskar College Of Engineering & Technology</td>
<td>A.K.T.University </td>
</tr>
<tr>
<td>12th </td>
<td>500</td>
<hr>
<td>470</td>
<td>First</td>
<td>S.B.V ROUSE AVENUE</td>
<td>C.B.S.E.</td>
</tr>
<tr>
<td>10th</td>
<td>600</td>
<td>488</td>
<td>first</td>
<td>S.B.V ROUSE AVENUE</td>
<td>C.B.S.E.</td>
</tr>
</table>
<hr>
<h1 style="font-size: 15pt;">TECHNICAL EXPERIENCE:</h1> Languages:
HTML, CSS, Java script, C,C++,Salesforce administration. Concepts: Networking,
operating systems
<hr><h1 style="font-size: 15pt;">LANGUAGES:</h1>Hindi, English
<hr>
<h1 style="font-size: 15pt;">INTEREST:</h1> 1.learning new programming
language</br> 2.Reading books</br>
3.website development
<hr>
<h1 style="font-size: 15pt;">REFERENCE:</h1> Will be provided on demand</pre>
<hr>
<h1>
</div>
</body>
</html
PROGRAM NO:- 02

Write an HTML program to design an entry form of student details and send it to
a database server like SQL, Oracle or MS Access.

HTML :

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Details Entry Form</title>
</head>
<body>
<h2>Student Details Entry Form</h2>
<form action="insert_student.php" method="post">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"><br>
<label for="age">Age:</label><br>
<input type="number" id="age" name="age"><br>
<label for="gender">Gender:</label><br>
<select id="gender" name="gender">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email"><br>
<label for="phone">Phone:</label><br>
<input type="tel" id="phone" name="phone"><br>
<label for="address">Address:</label><br>
<textarea id="address" name="address" rows="4"
cols="50"></textarea><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>

pHP :

<?php
// Database connection parameters
$servername = "localhost";
$username = "username"; // Replace with your MySQL username
$password = "password"; // Replace with your MySQL password
$dbname = "student_database"; // Replace with your MySQL database name

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

// Prepare SQL statement to insert data


$stmt = $conn->prepare("INSERT INTO students (name, age, gender, email, phone,
address) VALUES (?, ?, ?, ?, ?, ?)");

// Bind parameters and execute the statement


$stmt->bind_param("sissss", $_POST['name'], $_POST['age'], $_POST['gender'],
$_POST['email'], $_POST['phone'], $_POST['address']);
$stmt->execute();

// Close statement and connection


$stmt->close();
$conn->close();

// Redirect back to the form after inserting data


header("Location: student_details_form.html");
exit();
?>
Output :
PROGRAM NO:- 03

Write programs using Java script for Web Page to display


browsers information.

HTML :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0

Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Google map using Java script</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()" />

</div>

</form>

</body>

</html>
OUTPUT:-
PROGRAM NO:- 04

Write a Java applet to display the Application Program screen i.e.


calculator and other.
INPUT:-
imortjava.applet*;
import java.awt.*;
Importjava.awt.event.ActionEvet;
importjava.awt.event.ActionLister;
import java.awt.event.TextEvent;
importjava.awt.event.TextListenr;;
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;
TextField
t1;int
a,b,c;
public void init()

{
t1=new
TextField(10);
b1=new Button("1");
b2=new Button("2");
b3=new Button("3");
b4=new Button("4");
b5=new Button("5");
b6=new Button("6");
b7=new Button("7");
b8=new Button("8");
add=new
Button("+");
sub=new Button("-
"); mul=new
Button("*"); div=new
Button("/"); eq=new
Button("="); cl=new
Button("Clear");
GridLayout gb=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(th
is);
b2.addActionListener(th
is);
b3.addActionListener(th
is);
b4.addActionListener(th
is);
b5.addActionListener(th
is);
b6.addActionListener(th
is);
b7.addActionListener(th
is);
b8.addActionListener(th
is);
b9.addActionListener(th
is);
b0.addActionListener(th
is);
add.addActionListener(t
his);
sub.addActionListener(t
his);
mul.addActionListener(t
his);
div.addActionListener(t
his);
eq.addActionListener(th
is);
cl.addActionListener(thi
s); paint();
//t1.addTextListener(this);
}
public void paint()
{
setBackground(Color.green);
}
public void actionPerformed(ActionEvent e)
{
s=e.getActionCommand();
if(s.equals("0")||s.equals("1")||s.equals
("2")||
s.equals("3")||s.equals("4")||s.equals("5")||s.equals("6")||s.equals("7")||s.
equals("8")||s.equals("9")||s.equals("0"))
{
s1=t1.getText()
+s;
t1.setText(s1);
}
if(s.equals("+"))
{

s2=t1.getText
();
t1.setText("")
; s3="+";
}

if(s.equals("-"))
{

s2=t1.getTex
t();
t1.setText("")
; s3="-";
}
if(s.equals("*"))
{

s2=t1.getText();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("");
}
}
OUTPUT:-
PROGRAM NO:- 05

Writing program in XML for creation of DTD, which specifies a set of


rules. Create a style sheet in CSS/ XSL & display the document in internet
explorer.

INPUT:-
XML Code
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type=”text/css” href=”D:\workshop\rule.css”?>
<books>
<heading>Welcome to XML file </heading>
<book>
<title>Title : Web Programming</title>
<author>Author: Chrisbates</author>
<publisher>Publisher: Wiley</publisher>
<edition>Edition : 3</edition>
<price> Price : 300</price>
</book>
<book>
<title>Title: Internet world-wide-web</title>
<author>Author: Ditel</author>
<publisher>Publisher : Pearson</publisher>
<edition>Edition : 3</edition>
<price>Price: 400</price>
</book>
<title>Title: Computer Networks</title>
<author>Author: Foruouzan</author>
<publisher>Publisher: Mc Graw Hill</publisher>
<edition>Edition : 5</edition>
<price>Price: 700</price>
</book>
<book>
<title>Title : DBMS Concepts</title>
<author>Author: Navath</author>
<publisher>Publisher: Oxford</publisher>
<edition>Edition : 5</edition>
<price>Price: 600</price>
</book>
<book>
<title>Title : Linux Programming</title>
<author>Author: Subhitab Das</author>
<publisher>Publisher: Oxford</publisher>
<edition>Edition : 8</edition>
<price>Price : 300</price>
</book>
</books>

CSS Code
books
{ color:
white;
background-color
: gray;width:
100%;
}

heading {
color: green;
font-size:

40px;
background-color: powderblue;
}
heading, title, author, publisher, edition,
price {display: block;
}

title {
font-size: 25px;
font-weight:
bold;
}
OUTPUT:-
PROGRAM NO.-06
Program to illustrate JDBC connectivity and maintaining database by sending queries

HTML:

importjava.sql.*;

importjava.util.*;

class Main
{
public static void main(String a[])
{
//Creating the connection
String url =
"jdbc:oracle:thin:@localhost:1521:xe";
String user = "system";
String pass = "12345";

//Entering the data


Scanner k = new
Scanner(System.in);
System.out.println("enter
name"); String name =
k.next();
System.out.println("enter
roll no"); int roll =
k.nextInt();
System.out.println("enter
class"); String cls = k.next();

//Inserting data using SQL query


String sql = "insert into student1
values('"+name+"',"+roll+",'"+cls+"')"; Connection
con=null;
try
{
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
//Reference to connection interface
con = DriverManager.getConnection(url,user,pass);

Statement st =
con.createStatement(); int
m = st.executeUpdate(sql);
if (m == 1)
System.out.println("inserted
successfully : "+sql); else
System.out.println("insertio
n failed"); con.close();
}
catch(Exception ex)
{
System.err.println(ex);
}
}
}

OUTPUT:
PROGRAM NO.-07

Install APACHE TOMCAT web server . Access the static web pages for login id,
using this server.

PROGRAM :
<body>
<h2 align="center">Sign in</h2>
<form method="get" action="http://localhost:8888/india/Login.jsp">
<h3>
Enter ID <input type="text" name="t1"> <br>
Enter Password <input type="password" name="t2"> <br>
<input type="submit" value="Sign in">
</h3>
</body>
In the action attribute Login.jsp file is given to invoke. Assume localhost is
the server. The port number on which Tomcat is running is 8888. india is
the folder created in Tomcat. The attribute method can be given two
values of either get or post; here, get is given.
Following is the server-side JSP file that includes a Scriptlet to understand
what and how to code Scriptlet.
File Name: Login.jsp
<body>
<h2 align="center">Log in Validation </h2>

<%
String
str1=request.getParameter("
t1"); String
str2=request.getParameter("
t2");

if(str1.equalsIgnoreCase("snrao") && str2.equals("java"))


{
out.println("<h3>Your Login is Successful</h3>");
}
else
{
out.println("<h3>Sorry, your Login is Failed</h3>");
}
%>

</body>

OUTPUT:

Screenshot of HTML file SignIn.html when values are entered.


Screenshot of response when correct values are entered.

Screenshot of response when wrong values are entered.


PROGRAM NO.-08

Create a Cookie and add four user id’s and passwords to this Cookie.

PROGRAM:
<form action="servlet1" method="post">
Name:<input type="text"
name="userName"/><br/>
<input type="submit" value="go"/>
</form>

FirstServlet.java

import java.io.*; import

javax.servlet.*;

import javax.servlet.http.*;

public class FirstServlet extends HttpServlet {

public void doPost(HttpServletRequest request, HttpServletResponse

response){ try{

response.setContentType("text/html"); PrintWriter

out = response.getWriter(); String

n=request.getParameter("userName");

out.print("Welcome "+n);

Cookie ck=new Cookie("uname",n);//creating cookie object

response.addCookie(ck);//adding cookie in the response

//creating submit button out.print("<form


action='servlet2'>");

out.print("<input type='submit' value='go'>");

out.print("</form>"); out.close();

}catch(Exception e){System.out.println(e);}

}
SecondServlet.java import

java.io.*;

import javax.servlet.*;
import javax.servlet.http.*;

public class SecondServlet extends HttpServlet {

public void doPost(HttpServletRequest request,


HttpServletResponse response){ try{
response.setContentType("text/htm
l"); PrintWriter out =
response.getWriter();

Cookie
ck[]=request.getCookies();
out.print("Hello
"+ck[0].getValue());

out.close();

}catch(Exception e){System.out.println(e);}
}
}
web.xml
<web-app>

<servlet>
<servlet-name>s1</servlet-name>
<servlet-class>FirstServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>s1</servlet-name>
<url-pattern>/servlet1</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>s2</servlet-name>
<servlet-class>SecondServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>s2</servlet-name>
<url-pattern>/servlet2</url-pattern>
</servlet-mapping>
</web-app>

OUTPUT:
PROGRAM NO.-09

Write a java program/servlet/JSP to connect database and extract data from the
tables and display them.
PROGRAM :

Retrieve.jsp

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%

String id = request.getParameter("userid");
String driver ="com.mysql.jdbc.Driver";
String connectionUrl =
"jdbc:mysql://localhost:3306/"; String database = "test";
String userid = "root";
String password = ""; try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Connection connection = null; Statement
statement = null; ResultSet resultSet =
null;
%>
<!DOCTYPE html>
<html>
<body>

<h1>Retrieve data from database in jsp</h1>


<table border="1">
<tr>
<td>first name</td>

<td>last name</td>
<td>City name</td>
<td>Email</td>

</tr>
<%

</table>
</body>
</html>

After retrieve the data from the data base the table look like this.

Output :

id first name last name City name Email Id

1 Divyasundar Sahu Mumbai [email protected]

2 Hritika Sahu Pune [email protected]

3 Milan Jena Chennai [email protected]

You might also like