WT Lab Final
WT Lab Final
!DOCTYPE html>
<
<html>
<head>
<title>CSS Assignment</title>
<style>
/* 1. Font and Background Properties */
body {
font-family: 'Arial', sans-serif;
font-style: italic;
font-size: 18px;
background-image:
url('https://www.transparenttextures.com/patterns/brick-wall.png');
background-repeat: repeat;
background-color: #f0f8ff;
}
a:visited {
color: purple;
}
a:hover {
color: red;
text-decoration: underline;
}
a:active {
color: green;
}
.layer2 {
position: relative;
top: -30px;
left: 10px;
z-index: 1;
font-size: 80px;
color: red;
}
<p>This page demonstrates CSS font, background, link styles, layers, and custom
cursors.</p>
/body>
<
</html>
Set-3
!DOCTYPE html>
<
<html>
<head>
<title>Registration Form</title>
<style>
label {
display: block;
margin-top: 10px;
}
.error {
color: red;
font-size: 0.9em;
}
input, select, textarea {
margin-bottom: 5px;
}
</style>
</head>
<body>
<h2>Registration Form</h2>
<form onsubmit="return validateForm();">
<!-- Name -->
<label>Name:
input type="text" id="name">
<
<div id="nameError" class="error"></div>
/label>
<
br>
<
<input type="submit" value="Register">
/form>
<
<script>
function validateForm() {
let valid = true;
return valid;
}
/script>
<
</body>
</html>
et-4
S
Create XML document and internal and external DTD for bookstore
Elements:
Book,title,author, publisher, description,price,stock,genre.
Attributes:
Language, currency,date of publication.
<!DOCTYPE bookstore [
<!ATTLIST book
>
]>
<bookstore>
<title>The Alchemist</title>
<author>Paulo Coelho</author>
<publisher>HarperOne</publisher>
<price>15.99</price>
<stock>120</stock>
<genre>Fiction</genre>
</book>
<title>Atomic Habits</title>
<author>James Clear</author>
<publisher>Avery</publisher>
<price>11.50</price>
<stock>85</stock>
<genre>Self-help</genre>
</book>
</bookstore>
<!ATTLIST book
>
<!ELEMENT title (#PCDATA)>
Xml document
Xml document(shiporder.xml)
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderid" type="xs:string"/>
<xs:element name="customer" type="xs:string"/>
<xs:element name="items">
<xs:complexType>
<xs:sequence>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="price" type="xs:decimal"/>
<xs:element name="quantity" type="xs:positiveInteger"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element name="shippingplace" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderdate" type="xs:date" use="required"/>
<xs:attribute name="deliverydate" type="xs:date" use="required"/>
/xs:complexType>
<
</xs:element>
</xs:schema>
et-6
S
visual beans
Shapebean.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
public ShapeBean() {
currentColor = getRandomColor();
Override
@
protected void paintComponent(Graphics g) {
uper.paintComponent(g);
s
g.setColor(currentColor);
if (shape) {
g.fillRect(x, y, width, height); // Draw square
} else {
g.fillOval(x, y, width, height); // Draw circle
}
}
}
testBeanapp.java
import javax.swing.*;
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(bean);
frame.pack();
frame.setVisible(true);
}
}
et-7
S
write a servelt registration form which contain fields (fbame, mname, lname, email,
password,age,gender) and display it
et-8
S
Write a servlet about reading init parameters using web.xml( font-size, database usage ,
username and password) and display
et-9
S
Write a servlet code to Read context parameter from a web.xml file having contextServlet1,
contextServlet2 (database name,username, password) and display them
et-10
S
Sessions
Set -11
Armstrong number
Perfect number
Prime number
et-12
S
1)wap to calculate total salary basing on inputs taken from user like designation of
employee,basing on designation you must calculate net salary .
2)demo on different JSP page directives and predefined libraries.
et-13
S
:jdbc connection jsp/servlet create a database with atleast name, password,phone,email.
Database
USE studentDB;
Jsp code
<%
String url = "jdbc:mysql://localhost:3306/studentDB";
String user = "root"; // change if needed
String pass = ""; // your MySQL password
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(url, user, pass);
Statement stmt = con.createStatement();
while(rs.next()) {
>
%
<tr>
<td><%= rs.getString("name") %></td>
<td><%= rs.getString("password") %></td>
<td><%= rs.getString("phone") %></td>
<td><%= rs.getString("email") %></td>
</tr>
<%
}
con.close();
} catch(Exception e) {
out.println("Error: " + e.getMessage());
}
%>
</table>
</body>
</html>
et-14
S
Cookies
et-15
S
Create tables in the database which contain the details of items (books in our case like
Bookname , Price, Quantity, Amount )) of each category. Modify your catalogue page (week
2)in such a way that you should connect to the database and extract data from the tables
and display them in the catalogue page using JDBC.
Data base
USE bookDB;
- - Sample data
INSERT INTO books (bookname, author, publisher, price, quantity, amount, cover_image)
VALUES
('Java Basics', 'John Doe', 'TechBooks', 299.99, 10, 2999.90, 'images/java.jpg'),
('HTML & CSS', 'Jane Smith', 'WebBooks', 199.99, 5, 999.95, 'images/htmlcss.jpg');
Jsp code
<%
String url = "jdbc:mysql://localhost:3306/bookDB";
tring user = "root"; // change as needed
S
String pass = ""; // your MySQL password
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(url, user, pass);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM books");
while(rs.next()) {
>
%
<tr>
<td><img src="<%= rs.getString("cover_image") %>" width="100"/></td>
<td><%= rs.getString("bookname") %></td>
<td><%= rs.getString("author") %></td>
<td><%= rs.getString("publisher") %></td>
<td>₹<%= rs.getDouble("price") %></td>
<td><form><button type="submit">Add to Cart</button></form></td>
</tr>
<%
}
con.close();
} catch(Exception e) {
out.println("Database Error: " + e.getMessage());
}
%>
</table>
</body>
</html>