0% found this document useful (0 votes)
2 views46 pages

Activity WTL

The document consists of multiple experiments conducted by Abhishek Rajendra Thakare, focusing on various web development projects. The first experiment analyzes the top 10 domain registration websites, while subsequent experiments involve creating a restaurant webpage and a bus timetable management system using HTML, CSS, and XML. Each section includes objectives, methodologies, code snippets, and data visualizations relevant to the respective projects.

Uploaded by

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

Activity WTL

The document consists of multiple experiments conducted by Abhishek Rajendra Thakare, focusing on various web development projects. The first experiment analyzes the top 10 domain registration websites, while subsequent experiments involve creating a restaurant webpage and a bus timetable management system using HTML, CSS, and XML. Each section includes objectives, methodologies, code snippets, and data visualizations relevant to the respective projects.

Uploaded by

Abhishek Thakare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Name:Abhishek Rajendra Thakare

Class : TE
Div : C
Roll NO : T213051

Experiment No 1 (Activity No 2)
Title: Survey on Top 10 Domain Registration Websites

1. Objective:
To analyze and identify the most commonly used domain registration websites based on:
 Popularity
 Ease of use
 Scalability
 Industry adoption

2. Methodology:
 Conducted online research through official websites, comparison tools (like
HostAdvice, TechRadar), Trustpilot reviews, and industry blogs.
 Analyzed user experiences, service scalability, and pricing transparency.
 Summarized findings in a comparative table and graphical chart.

3. Top 10 Domain Registration Websites (2025)


Domain Popularity Ease of Scalability Industry
Rank Notable Features
Registrar ⭐ Use 🧩 🚀 Adoption 🌐

Bulk registration,
1 GoDaddy 9.5/10 9/10 9/10 High WHOIS privacy,
auctions

Free WHOIS
2 Namecheap 9.3/10 9.5/10 8.5/10 High privacy, intuitive
dashboard

Clean UI, Google


Google
3 9/10 10/10 9/10 Medium Workspace
Domains
integration
Domain Popularity Ease of Scalability Industry
Rank Notable Features
Registrar ⭐ Use 🧩 🚀 Adoption 🌐

High (for Free domain with


4 Bluehost 8.7/10 8.5/10 8/10
hosting too) hosting, good support

Affordable bundles,
5 HostGator 8.5/10 8.2/10 8/10 Medium
web hosting friendly

Free privacy, one-


6 DreamHost 8.2/10 8.8/10 8/10 Medium click WordPress
install

Low to Ad-free checkout,


7 Hover 8/10 9.2/10 7.5/10
Medium great for personal use

Low to Powerful control


8 Dynadot 7.8/10 8.5/10 8/10
Medium panel, cheap domains

Simple UI, decent


9 [Link] 7.5/10 8.5/10 7.8/10 Medium
support

Business solutions,
10 1&1 IONOS 7.3/10 7.8/10 8/10 Medium
good performance

4. Data Visualization
📊 Comparison Graph (Radar Chart)
Categories: Popularity, Ease of Use, Scalability, Industry Adoption

5. Insights & Recommendations


🔍 Insights:
 GoDaddy re
 mains a leader due to brand trust, services, and scalability.
 Namecheap offers the best combination of affordability and ease of use for beginners.
 Google Domains excels in UI/UX but lacks advanced reseller tools.
 Hover and Dynadot are great for users who prefer clean, ad-free interfaces.
 Most platforms offer WHOIS privacy, but not all include it for free.
✅ Recommendations by Use Case:
Use Case Recommended Platform Reason

Personal Website Hover, Namecheap Simple UI, privacy-focused, low cost


Use Case Recommended Platform Reason

Google Domains, Easy integration, fast setup, affordable


Startup
Namecheap scaling

E-commerce/Business GoDaddy, Bluehost Scalable, business tools, bundled hosting

Bulk features, domain auctions, reseller


Domain Reseller Dynadot, GoDaddy
tools

[Link], Google API access, G Suite integration, DNS


Developers
Domains controls

6. Conclusion
The domain registration landscape is diverse with options for different user needs. Based on
our comparative analysis:
 Namecheap is ideal for overall value and beginner friendliness.
 GoDaddy offers extensive scalability for enterprises.
 Google Domains is the best choice for users within the Google ecosystem.

Name:Abhishek Rajendra Thakare


Class : TE
Div : C
Roll NO : T213051

Experiment No 2 (Activity )
Title : Create Restaurant Web Page Design Using HTML & CSS
Code:
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Spice Delight - Restaurant</title>

<!-- Internal CSS -->


<style>
body {
font-family: Arial, sans-serif;
background-color: #fff8f0;
margin: 0;
padding: 0;
}
.container {
width: 90%;
margin: auto;
}
h2 {
color: #d2691e;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #ccc;
padding: 10px;
text-align: left;
}
.menu-list {
background-color: #f9f3e9;
padding: 10px;
}
</style>

<!-- External CSS -->


<link rel="stylesheet" href="[Link]">
</head>
<body>

<div class="container">
<h1 style="color: darkgreen;">Welcome to Spice Delight!</h1> <!-- Inline CSS -->

<p>Experience authentic flavors and a cozy ambiance at Spice Delight, your favorite
family restaurant.</p>

<img src="[Link]
alt="Restaurant Banner" width="100%">

<h2>Our Specials</h2>
<table>
<tr>
<th>Dish</th>
<th>Description</th>
<th>Price</th>
</tr>
<tr>
<td>Paneer Butter Masala</td>
<td>Creamy tomato-based curry with soft paneer cubes.</td>
<td>₹250</td>
</tr>
<tr>
<td>Chicken Biryani</td>
<td>Fragrant rice cooked with tender chicken and spices.</td>
<td>₹300</td>
</tr>
</table>

<h2>Menu Categories</h2>
<ul class="menu-list">
<li>Starters</li>
<li>Main Course</li>
<li>Beverages</li>
<li>Desserts</li>
</ul>

<h2>Order Now</h2>
<form>
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"><br><br>

<label for="dish">Select Dish:</label><br>


<select id="dish" name="dish">
<option value="paneer">Paneer Butter Masala</option>
<option value="biryani">Chicken Biryani</option>
</select><br><br>
<label for="qty">Quantity:</label><br>
<input type="number" id="qty" name="qty" min="1" value="1"><br><br>

<input type="submit" value="Place Order">


</form>

<h2>Find Us Here</h2>
<!-- iFrame for Google Map -->
<iframe
src="[Link]
1d3153.019175419158!2d-122.41941528468153!3d37.77492927975979!2m3!1f0!2f0!3f0!
3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x8085809cbaa3213f%3A0x1810b8dc9a6b6f70!
2sRestaurant!5e0!3m2!1sen!2sus!4v1618355791883"
width="100%"
height="300"
style="border:0;"
allowfullscreen=""
loading="lazy">
</iframe>

<footer>
<p>&copy; 2025 Spice Delight. All Rights Reserved.</p>
</footer>
</div>

</body>
</html>
[Link]
/* External CSS file */
h1 {
font-size: 36px;
text-align: center;
margin-top: 20px;
}

p{
font-size: 18px;
color: #333;
text-align: center;
}

form {
background-color: #f2f2f2;
padding: 15px;
border-radius: 8px;
}

input[type="text"],
input[type="number"],
select {
width: 100%;
padding: 8px;
margin-top: 4px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}

input[type="submit"] {
background-color: #d2691e;
color: white;
border: none;
padding: 10px 20px;
cursor: pointer;
font-weight: bold;
}

footer {
text-align: center;
margin-top: 40px;
font-size: 14px;
color: #888;
}
OUTPUT:
Name:Abhishek Rajendra Thakare
Class : TE
Div : C
Roll NO : T213051

Experiment No 3 (Activity )
Title : Create Bus Time Table Management System
Code:
Bus_timetable.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="[Link]"?>
<busTimetable xmlns:xsi="[Link]
xsi:noNamespaceSchemaLocation="bus_timetable.xsd">
<bus>
<route>Pune to Mumbai</route>
<type>Express</type>
<time>22:30</time>
<days>Weekdays</days>
</bus>
<bus>
<route>Mumbai to Nashik</route>
<type>Luxury</type>
<time>18:15</time>
<days>Weekends</days>
</bus>
<bus>
<route>Nagpur to Pune</route>
<type>Sleeper</type>
<time>01:00</time>
<days>Daily</days>
</bus>
</busTimetable>
Bus_timetable.dtd
<!ELEMENT busTimetable (bus+)>
<!ELEMENT bus (route, type, time, days)>
<!ELEMENT route (#PCDATA)>
<!ELEMENT type (#PCDATA)>
<!ELEMENT time (#PCDATA)>
<!ELEMENT days (#PCDATA)>
Bus_timetable.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="[Link]

<xs:element name="busTimetable">
<xs:complexType>
<xs:sequence>
<xs:element name="bus" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="route" type="xs:string"/>
<xs:element name="type" type="xs:string"/>
<xs:element name="time" type="xs:string"/>
<xs:element name="days" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
[Link]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="[Link]

<xsl:output method="html" indent="yes"/>

<xsl:template match="/">
<html>
<head>
<title>Bus Time Table</title>
<link rel="stylesheet" href="[Link]" />
</head>
<body>
<h1>Bus Time Table</h1>
<table>
<tr>
<th>Route</th>
<th>Type</th>
<th>Time</th>
<th>Days</th>
</tr>
<xsl:for-each select="busTimetable/bus">
<tr>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="contains(time, ':') and substring-before(time, ':') &lt;
6">night</xsl:when>
<xsl:when test="days='Weekends'">weekend</xsl:when>
<xsl:otherwise>normal</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td><xsl:value-of select="route"/></td>
<td><xsl:value-of select="type"/></td>
<td><xsl:value-of select="time"/></td>
<td><xsl:value-of select="days"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>
[Link]
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
padding: 20px;
}

h1 {
text-align: center;
color: #333;
}

table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}

th, td {
padding: 10px;
border: 1px solid #ccc;
text-align: center;
}

th {
background-color: #333;
color: white;
}

.night {
background-color: #ffcccc;
}

.weekend {
background-color: #d1e7dd;
}

.normal {
background-color: #ffffff;
}
OUTPUT :
Name:Abhishek Rajendra Thakare
Class : TE
Div : C
Roll NO : T213051

Experiment No 4 (Activity )
Title : Activity 1: Create Bus Time Table Management System
Code:
bus_timetable.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE buses SYSTEM "bus_timetable.dtd">
<buses xmlns:xsi="[Link]
xsi:noNamespaceSchemaLocation="bus_timetable.xsd">
<bus>
<route>Pune to Mumbai</route>
<type>AC</type>
<departure>06:00</departure>
<arrival>10:00</arrival>
<days>Weekdays</days>
</bus>
<bus>
<route>Mumbai to Nashik</route>
<type>Non-AC</type>
<departure>22:30</departure>
<arrival>03:00</arrival>
<days>Weekend</days>
</bus>
</buses>
[Link]
<!ELEMENT buses (bus+)>
<!ELEMENT bus (route, type, departure, arrival, days)>
<!ELEMENT route (#PCDATA)>
<!ELEMENT type (#PCDATA)>
<!ELEMENT departure (#PCDATA)>
<!ELEMENT arrival (#PCDATA)>
<!ELEMENT days (#PCDATA)>
bus_timetable.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="[Link]
<xs:element name="buses">
<xs:complexType>
<xs:sequence>
<xs:element name="bus" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="route" type="xs:string"/>
<xs:element name="type" type="xs:string"/>
<xs:element name="departure" type="xs:string"/>
<xs:element name="arrival" type="xs:string"/>
<xs:element name="days" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
bus_timetable.xslt
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="[Link]
<xsl:output method="html"/>

<xsl:template match="/">
<html>
<head>
<title>Bus Timetable</title>
<link rel="stylesheet" type="text/css" href="[Link]"/>
</head>
<body>
<h2>Bus Time Table</h2>
<table border="1">
<tr>
<th>Route</th>
<th>Type</th>
<th>Departure</th>
<th>Arrival</th>
<th>Days</th>
</tr>
<xsl:for-each select="buses/bus">
<tr>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="contains(days, 'Weekend')">weekend</xsl:when>
<xsl:when test="substring(departure, 1, 2) &gt;= 21 or substring(departure, 1, 2)
&lt;= 5">night</xsl:when>
<xsl:otherwise>weekday</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td><xsl:value-of select="route"/></td>
<td><xsl:value-of select="type"/></td>
<td><xsl:value-of select="departure"/></td>
<td><xsl:value-of select="arrival"/></td>
<td><xsl:value-of select="days"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
OUTPUT:
Name:Abhishek Rajendra Thakare
Class : TE
Div : C
Roll NO : T213051

Experiment No 5 (Activity )
Title : ACTIVITY 1: DEPOSIT AND WITHDRAW TRANSACTIONS USING EJB
Code:
[Link]
package [Link];

import [Link];

@Stateless
public class BankBean {

private double balance = 0.0;

public String deposit(double amount) {


if (amount > 0) {
balance += amount;
return "Deposited: ₹" + amount + ". Current Balance: ₹" + balance;
} else {
return "Invalid deposit amount!";
}
}

public String withdraw(double amount) {


if (amount <= 0) {
return "Invalid withdrawal amount!";
} else if (amount > balance) {
return "Insufficient funds! Current Balance: ₹" + balance;
} else {
balance -= amount;
return "Withdrawn: ₹" + amount + ". Current Balance: ₹" + balance;
}
}

public double getBalance() {


return balance;
}
}
[Link]
package [Link];

import [Link];

import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];

@WebServlet("/bank")
public class BankClientServlet extends HttpServlet {

@EJB
private BankBean bank;

protected void doGet(HttpServletRequest request, HttpServletResponse response)


throws ServletException, IOException {

double depositAmount = 1000.0;


double withdrawAmount = 500.0;

[Link]("text/html");
[Link]().println("<h1>Bank Transaction</h1>");
[Link]().println("<p>" + [Link](depositAmount) + "</p>");
[Link]().println("<p>" + [Link](withdrawAmount) + "</p>");
[Link]().println("<p>Final Balance: ₹" + [Link]() + "</p>");
}
}
OUTPUT:
Name:Abhishek Rajendra Thakare
Class : TE
Div : C
Roll NO : T213051

Experiment No 6 (Activity )
Code:
[Link]
<%@ page import="[Link].*, [Link].*, [Link].*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Student Management</title>
<link rel="stylesheet" href="[Link]" />
</head>
<body>
<div class="container">
<h1>Student Table</h1>

<!-- Search Filter -->


<form action="[Link]" method="get">
<input type="text" name="filter" placeholder="Search by Class or Division" />
<select name="sortBy">
<option value="">Sort By</option>
<option value="name">Name</option>
<option value="city">City</option>
</select>
<button type="submit">Apply</button>
</form>
<br/>
<a href="[Link]" class="btn">Add New Student</a>

<jsp:include page="[Link]" />


</div>
</body>
</html>
[Link]
<%@ page import="[Link].*" %>
<%!
class Student {
String name, city, studentClass, division;
Student(String n, String c, String cls, String div) {
name = n; city = c; studentClass = cls; division = div;
}
}

ArrayList<Student> getStudents() {
ArrayList<Student> list = new ArrayList<>();
[Link](new Student("Aman", "Pune", "10", "A"));
[Link](new Student("Bina", "Mumbai", "9", "B"));
[Link](new Student("Chetan", "Pune", "10", "C"));
[Link](new Student("Disha", "Nashik", "8", "A"));
return list;
}
%>

<%
String filter = [Link]("filter");
String sortBy = [Link]("sortBy");
ArrayList<Student> students = getStudents();

if (filter != null && ![Link]()) {


[Link](s -> !([Link](filter) ||
[Link](filter)));
}

if ("name".equalsIgnoreCase(sortBy)) {
[Link]([Link](s -> [Link]));
} else if ("city".equalsIgnoreCase(sortBy)) {
[Link]([Link](s -> [Link]));
}
%>

<table border="1" cellpadding="10">


<tr>
<th>Name</th>
<th>City</th>
<th>Class</th>
<th>Division</th>
</tr>
<%
for (Student s : students) {
%>
<tr>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
<td><%= [Link] %></td>
</tr>
<% } %>
</table>
[Link]
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Add Student</title>
<link rel="stylesheet" href="[Link]" />
</head>
<body>
<div class="container">
<h2>Add New Student</h2>
<form action="[Link]" method="post">
<input type="text" name="name" placeholder="Student Name" required><br>
<input type="text" name="city" placeholder="City" required><br>
<input type="text" name="class" placeholder="Class" required><br>
<input type="text" name="division" placeholder="Division" required><br>
<button type="submit">Submit</button>
</form>
<br/>
<a href="[Link]">Back to Student Table</a>
</div>
</body>
</html>
OUTPUT
Name:Abhishek Rajendra Thakare
Class : TE
Div : C
Roll NO : T213051

Experiment No 7 (Activity )
Title : Activity 1: Displaying User Data Dynamically
Code:
SQL
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100)
);

INSERT INTO users (name, email) VALUES


('Abhishek Thakare', 'abhishek@[Link]'),
('Aarti Sharma', 'aarti@[Link]'),
('Rohan Patil', 'rohan@[Link]');
[Link]
<?php
$host = "localhost";
$user = "root";
$password = "";
$database = "your_database_name"; // Change to your DB name

$conn = mysqli_connect($host, $user, $password, $database);

if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>
[Link]
<?php include '[Link]'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Display Users</title>
<link rel="stylesheet" href="[Link]">
</head>
<body>
<div class="container">
<h1>User List</h1>
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM users";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo "<tr>
<td>{$row['id']}</td>
<td>{$row['name']}</td>
<td>{$row['email']}</td>
</tr>";
}
} else {
echo "<tr><td colspan='3'>No users found</td></tr>";
}

mysqli_close($conn);
?>
</tbody>
</table>
</div>
</body>
</html>
OUTPUT
Name:Abhishek Rajendra Thakare
Class : TE
Div : C
Roll NO : T213051

Experiment No 8 (Activity )
Title : Activity 1: Feedback Form Using Struts
Code :
[Link]
<%@ taglib uri="[Link] prefix="html" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Feedback Form</title>
</head>
<body>
<h2>Feedback Form</h2>
<html:form action="/submitFeedback">
<table>
<tr>
<td>Full Name:</td>
<td><html:text property="name" /></td>
<td><html:error property="name" /></td>
</tr>
<tr>
<td>Email Address:</td>
<td><html:text property="email" /></td>
<td><html:error property="email" /></td>
</tr>
<tr>
<td>Rating (1–5):</td>
<td>
<html:select property="rating">
<html:option value="1">1</html:option>
<html:option value="2">2</html:option>
<html:option value="3">3</html:option>
<html:option value="4">4</html:option>
<html:option value="5">5</html:option>
</html:select>
</td>
<td><html:error property="rating" /></td>
</tr>
<tr>
<td>Comments:</td>
<td><html:textarea property="comments" rows="4" cols="50" /></td>
<td><html:error property="comments" /></td>
</tr>
<tr>
<td><html:submit value="Submit" /></td>
</tr>
</table>
</html:form>
</body>
</html>
[Link]
package [Link];

import [Link];
public class FeedbackForm extends ActionForm {
private String name;
private String email;
private String rating;
private String comments;

// Getters and setters for each property


public String getName() { return name; }
public void setName(String name) { [Link] = name; }

public String getEmail() { return email; }


public void setEmail(String email) { [Link] = email; }

public String getRating() { return rating; }


public void setRating(String rating) { [Link] = rating; }

public String getComments() { return comments; }


public void setComments(String comments) { [Link] = comments; }

// Validation logic
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();

if (name == null || [Link]().isEmpty()) {


[Link]("name", new ActionMessage("[Link]"));
}
if (email == null || ![Link]("^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]
+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$")) {
[Link]("email", new ActionMessage("[Link]"));
}
if (rating == null || [Link]().isEmpty()) {
[Link]("rating", new ActionMessage("[Link]"));
}
if (comments == null || [Link]().isEmpty()) {
[Link]("comments", new ActionMessage("[Link]"));
}
return errors;
}
}
[Link]
package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class FeedbackAction extends Action {


public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {

FeedbackForm feedbackForm = (FeedbackForm) form;

// In a real app, save the feedback data to the database here

// If validation succeeds, forward to the thank-you page


return [Link]("thankyou");
}
}
[Link]
<struts-config>
<form-beans>
<form-bean name="feedbackForm" type="[Link]" />
</form-beans>

<action-mappings>
<action path="/submitFeedback"
type="[Link]"
name="feedbackForm"
scope="request"
input="/[Link]"
validate="true">
<forward name="thankyou" path="/[Link]" />
</action>
</action-mappings>
</struts-config>
OUTPUT
Name:Abhishek Rajendra Thakare
Class : TE
Div : C
Roll NO : T213051

Experiment No 9 (Activity )
Title : Activity 1 Deposit and Withdraw Transactions using EJB
Code :
Mysql
CREATE DATABASE bank;

USE bank;

CREATE TABLE accounts (


id INT AUTO_INCREMENT PRIMARY KEY,
user_name VARCHAR(255) NOT NULL,
balance DECIMAL(10, 2) DEFAULT 0.00
);

-- Insert a sample account


INSERT INTO accounts (user_name, balance) VALUES ('John Doe', 1000.00);
package [Link];

import [Link];
import [Link];
import [Link];
import [Link];

@Stateless
public class BankTransactionBean {
@PersistenceContext
private EntityManager em;

// Deposit money into an account


public void deposit(int accountId, double amount) {
Account account = [Link]([Link], accountId);
if (account != null) {
double newBalance = [Link]() + amount;
[Link](newBalance);
[Link](account);
}
}

// Withdraw money from an account


public void withdraw(int accountId, double amount) throws Exception {
Account account = [Link]([Link], accountId);
if (account != null) {
double currentBalance = [Link]();
if (currentBalance >= amount) {
double newBalance = currentBalance - amount;
[Link](newBalance);
[Link](account);
} else {
throw new Exception("Insufficient funds");
}
}
}
}
Account Entity Model
package [Link];

import [Link];
import [Link];

@Entity
public class Account {

@Id
private int id;
private String userName;
private double balance;

// Getters and Setters

public int getId() {


return id;
}

public void setId(int id) {


[Link] = id;
}

public String getUserName() {


return userName;
}

public void setUserName(String userName) {


[Link] = userName;
}
public double getBalance() {
return balance;
}

public void setBalance(double balance) {


[Link] = balance;
}
}
[Link]
html
CopyEdit
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Deposit Money</title>
</head>
<body>
<h2>Deposit Money</h2>
<form action="depositServlet" method="POST">
<label for="accountId">Account ID:</label>
<input type="number" name="accountId" required><br><br>

<label for="amount">Amount:</label>
<input type="number" name="amount" required><br><br>

<button type="submit">Deposit</button>
</form>
</body>
</html>
OUTPUT
Name:Abhishek Rajendra Thakare
Class : TE
Div : C
Roll NO : T213051

Experiment No 10 (Activity )
Title : Activity 1 Deposit and Withdraw Transactions using EJB
Code :
Mysql
CREATE DATABASE bank;

USE bank;

CREATE TABLE accounts (


id INT AUTO_INCREMENT PRIMARY KEY,
user_name VARCHAR(255) NOT NULL,
balance DECIMAL(10, 2) DEFAULT 0.00
);

-- Insert a sample account


INSERT INTO accounts (user_name, balance) VALUES ('John Doe', 1000.00);
package [Link];

import [Link];
import [Link];
import [Link];
import [Link];

@Stateless
public class BankTransactionBean {
@PersistenceContext
private EntityManager em;

// Deposit money into an account


public void deposit(int accountId, double amount) {
Account account = [Link]([Link], accountId);
if (account != null) {
double newBalance = [Link]() + amount;
[Link](newBalance);
[Link](account);
}
}

// Withdraw money from an account


public void withdraw(int accountId, double amount) throws Exception {
Account account = [Link]([Link], accountId);
if (account != null) {
double currentBalance = [Link]();
if (currentBalance >= amount) {
double newBalance = currentBalance - amount;
[Link](newBalance);
[Link](account);
} else {
throw new Exception("Insufficient funds");
}
}
}
}
Account Entity Model
package [Link];

import [Link];
import [Link];

@Entity
public class Account {

@Id
private int id;
private String userName;
private double balance;

// Getters and Setters

public int getId() {


return id;
}

public void setId(int id) {


[Link] = id;
}

public String getUserName() {


return userName;
}

public void setUserName(String userName) {


[Link] = userName;
}
public double getBalance() {
return balance;
}

public void setBalance(double balance) {


[Link] = balance;
}
}
[Link]
html
CopyEdit
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Deposit Money</title>
</head>
<body>
<h2>Deposit Money</h2>
<form action="depositServlet" method="POST">
<label for="accountId">Account ID:</label>
<input type="number" name="accountId" required><br><br>

<label for="amount">Amount:</label>
<input type="number" name="amount" required><br><br>

<button type="submit">Deposit</button>
</form>
</body>
</html>
OUTPUT

You might also like