Module I: Introduction to Web Technologies & Architectures
Write short notes on the following :
(a) HTML commands
(b) DHTML dragging and drooping
(c) AWT
(d) JDBC
Answer: Short Notes on Web & Java Technologies
(a) HTML Commands (Tags & Elements)
HTML (HyperText Markup Language) commands (commonly referred to as HTML tags and elements) are syntax keywords enclosed within angle brackets (<tagname>) used to define the structure, content, and hypermedia links of a webpage.
Core HTML Command Categories:
- Document Skeleton Commands:
<!DOCTYPE html>: Declares HTML5 document type.<html>,<head>,<body>: Defines the root, metadata, and visible document body.
- Text Formatting Commands:
<h1>to<h6>: Headings;<p>: Paragraph;<br>: Line break;<hr>: Horizontal rule.
- Hyperlinks & Media Commands:
<a href="...">: Creates clickable hyperlinks.<img src="..." alt="...">: Embeds images.
- Lists & Tables:
<ul>,<ol>,<li>: Unordered (bulleted) and ordered (numbered) lists.<table>,<tr>,<th>,<td>: Renders structured tabular data.
- Interactive Forms:
<form>,<input>,<select>,<button>,<textarea>: Collects user data.
(b) DHTML Dragging and Dropping
DHTML (Dynamic HTML) is not a standalone language, but rather the synergistic combination of HTML, CSS, JavaScript, and the Document Object Model (DOM) to create interactive, animated web pages.
Drag and Drop Mechanism:
Drag and Drop allows users to click, grab an onscreen element, drag it over a target zone, and drop it.
[Draggable Element] -- (dragstart) --> [Dragging Over Target] -- (drop) --> [Dropped Element]
(draggable="true") (event.preventDefault()) (dataTransfer)
Core HTML5 / DHTML Drag-and-Drop Events:
dragstart: Fires when the user starts dragging an element. Usesevent.dataTransfer.setData("text", target.id)to store data.dragover: Fires continuously when a dragged element is over a valid drop target. Must invokeevent.preventDefault()to allow dropping.drop: Fires when the dragged item is released over the drop target. Retrieves data viaevent.dataTransfer.getData("text").
<div id="dragItem" draggable="true" ondragstart="event.dataTransfer.setData('text', this.id)">
Drag Me
</div>
<div id="dropZone" ondragover="event.preventDefault()" ondrop="this.appendChild(document.getElementById(event.dataTransfer.getData('text')))">
Drop Zone
</div>
(c) AWT (Abstract Window Toolkit)
AWT (java.awt) is Java's original, platform-dependent Graphical User Interface (GUI) framework introduced in JDK 1.0.
+-----------------------------+
| Component |
+--------------+--------------+
|
+------------------------+------------------------+
| |
v v
+--------------------+ +--------------------+
| Basic Controls | | Container |
| Button, Checkbox, | | (Panel, Window, |
| Label, TextField | | Frame, Dialog) |
+--------------------+ +--------------------+
Key Features of AWT:
- Heavyweight Components: AWT components rely directly on the underlying operating system's native GUI peer widgets (e.g., a
java.awt.Buttoncreates a native Windows button on Windows and a Motif button on Unix). - Container Hierarchy:
Frame: Top-level window with a title bar, border, and minimize/maximize buttons.Panel: Space-allocating container used to group components.
- Layout Managers: Automatically arrange component geometry (
FlowLayout,BorderLayout,GridLayout,GridBagLayout). - Event Delegation Model: Decouples event sources (e.g.,
Button) from event listeners (ActionListener,MouseListener).
(d) JDBC (Java Database Connectivity)
JDBC (java.sql / javax.sql) is the standard Java API specification that enables Java applications to interact independently with relational database management systems (RDBMS like MySQL, Oracle, PostgreSQL).
+-----------------------+
| Java Application |
+-----------+-----------+
| (JDBC API Calls)
v
+-----------------------+
| JDBC DriverManager |
+-----------+-----------+
|
v
+-----------------------+
| JDBC Driver (MySQL) |
+-----------+-----------+
| (Database Protocol)
v
+-----------------------+
| RDBMS Database |
+-----------------------+
Standard 5 Steps to Execute JDBC Operations:
- Load Driver Class:
Class.forName("com.mysql.cj.jdbc.Driver"); - Establish Database Connection:
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db", "root", "password"); - Create Statement:
Statement stmt = con.createStatement(); // Or PreparedStatement for parameterized SQL - Execute SQL Query:
ResultSet rs = stmt.executeQuery("SELECT * FROM students"); while (rs.next()) { System.out.println(rs.getInt("roll_no") + " : " + rs.getString("name")); } - Close Resources:
rs.close(); stmt.close(); con.close();