DOTWEB5(OJ7) SamplesĀ for WebApplicationĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
š DOTWEB(OJ7) Samples for WebApplication
š Sample A: Introduction
Why Java/J2EE is not a secure programming language
Difference between Java (JDK 1.8) and DotWeb5 (OJ7)
Overview of DotWeb5 (OJ7) Divisions and FAQs
š¹ DotWeb5 (OJ7) Divisions
DotWeb5 (OJ7) is organized into six divisions:
Scroll Server with DotWeb5 (OJ7)
Supports .web and .ojava7 formats.
Scroll Server with Java/J2EE and JDK 1.8 Compiler
DotWeb5 compiler is not used here.
JDK 1.8 is required because frameworks like Hibernate, MyBatis, Java Spring, and EJB are written in JDK 1.8.
Limitations: JSP and Servlets do not work in Scroll Server, but EJB and JMS are supported.
Scroll Server with .java7 using DotWeb5 (OJ7) Compiler
Machine Learning and Data Science
Supported through user-friendly frameworks (OJ7UA).
Advanced Samples
Includes .web and DotWeb5 (OJ7) console applications.
Remote-X Application (Advanced)
Not yet released.
ā Doubtful FAQs
Can DotWeb5 (OJ7) compiler work with JDK 1.8 and Java/J2EE frameworks?
No.
Can DotWeb5 (OJ7) compile JDK 1.8 programs?
No, it does not accept JDK 1.8 or later versions.
Is DotWeb5 (OJ7) a competitor to Java/J2EE?
No, its business model is entirely different from Oracleās.
Can DotWeb5 (OJ7) work as a standalone application?
Yes, it functions independently of Java/J2EE.
Is DotWeb5 (OJ7) a secure programming language?
Yes, it is designed with high security in mind.
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā TheĀ DifferencesĀ Between Ā Java(JDK 1.8) orĀ Java latest version and Ā DotWeb5(OJ7)Ā areĀ given below...
ā ļø Demerits of Java/J2EE Programming Language
š Why Java/J2EE Is Not Secure
Java programs are compiled into .class files. These files can be easily decompiled using tools such as JAD Decompiler, which converts compiled bytecode back into readable source code. As a result, sensitive information such as database connections and business logic becomes exposed, leading to a complete failure of security across Java JDK 1.8 and other versions.
š Example: MySQL Program in Java
import java.sql.*;Ā Ā
class MysqlCon{Ā Ā
public static void main(String args[]){Ā Ā
try{Ā Ā
Class.forName("com.mysql.jdbc.Driver");Ā Ā
Connection con=DriverManager.getConnection(Ā Ā
"jdbc:mysql://localhost:3306/wil","root","Dove12345");Ā Ā
//here sonoo is database name, root is username and passwordĀ Ā
Statement stmt=con.createStatement();Ā Ā
ResultSet rs=stmt.executeQuery("select * from emp");Ā Ā
while(rs.next())Ā Ā
System.out.println(rs.getInt(1)+"Ā "+rs.getString(2)+"Ā "+rs.getString(3));Ā Ā
con.close();Ā Ā
}catch(Exception e){ System.out.println(e);}Ā Ā
}Ā Ā
}Ā Ā
š Decompiled Output (via JAD)
MysqlCon.jadĀ
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)Ā
// Source File Name: Ā MysqlCon.java
Ā
import java.io.PrintStream;
import java.sql.*;
Ā
class MysqlCon
{
Ā
Ā Ā Ā Ā MysqlCon()
Ā Ā Ā Ā {
Ā Ā Ā Ā }
Ā
Ā Ā Ā Ā public static void main(String args[])
Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā try
Ā Ā Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Class.forName("com.mysql.jdbc.Driver");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/wil", "root", "Dove12345");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Statement statement = connection.createStatement();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā for(ResultSet resultset = statement.executeQuery("select * from emp"); resultset.next(); System.out.println((new StringBuilder()).append(resultset.getInt(1)).append("Ā ").append(resultset.getString(2)).append("Ā ").append(resultset.getString(3)).toString()));
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā connection.close();
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā catch(Exception exception)
Ā Ā Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā System.out.println(exception);
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā }
}
šØ Security Implications
All database connections and business logic are visible to hackers.
Writing Java programs becomes risky, as attackers can easily steal data.
Vulnerabilities extend across EJB, Servlet, JSP, and JMS frameworks.
This is why Java/J2EE is considered weak in security.
š Emergence of DotWeb5 (OJ7)
To address these shortcomings, a new interactive, secure, and advanced programming language was introduced: DotWeb5 (OJ7).
Created in DotWeb3.0 and Java JDK 1.6 by Wilmix Jemin J.
Designed to be highly secure, user-friendly, and cost-effective.
Supports advanced features like obfuscation, shortest function statements, and WNOSQL database integration.
š¤ Expansion of DotWeb5 (OJ7)
Dotā stands for versatile and music.
W ā Wilmix (Inventor)
E ā Electronic (technology, business, internet: e-commerce, e-mail, e-learning)
B ā Contextual meanings (brother, base, born, etc.)
5 ā Adventure, linked to Remote-X Application
0 ā Represents additional features in DotWeb5.0
O ā Olive
J ā Jemin
7 ā Completeness, perfection, spirituality, and pursuit of knowledge
ā Key Takeaway
Developers must understand the difference between DotWeb5 (OJ7) and JDK 1.8 to fully appreciate the security, efficiency, and advanced capabilities offered by DotWeb5 (OJ7).
š SAMPLEā17: Performing an Autocomplete Operation
š¹ Overview
This sample demonstrates how to perform an autocomplete operation using DotWeb5 (OJ7) in combination with HTML and jQuery.
š„ļø DotWeb5 (OJ7) Program
<WEB> //startĀ ofĀ DotWeb5(OJ7) program
Ā
<PACK> Program12 //Ā createĀ namespaceĀ asĀ Program12 soĀ thatĀ we canĀ useĀ thisĀ namespaceĀ asĀ aĀ libraryĀ inĀ
//anotherĀ DotWeb5(OJ7) program
{
Ā Ā
Ā Ā Ā Ā <CLASS> Prog //Ā <CLASS> representsĀ classĀ Ā
Ā Ā Ā {
Ā
Ā Ā
Ā Ā Ā Ā Ā Ā public void main() //Ā CĀ type main
Ā Ā Ā Ā Ā Ā {Ā
HTML.displayhtml("autocomplete1.html"); //Ā nowĀ yourĀ declareĀ HTML.displayhtml //toĀ loadĀ autocomplete1.html
Ā
Ā Ā Ā <PRINTLN>("[");
Ā Ā Ā <PRINTLN>("'JWEB(JDollar)',");
Ā Ā Ā <PRINTLN>("'DOTWEB',");
Ā Ā Ā <PRINTLN>("'DotWeb5(OJ7)',");
Ā Ā Ā <PRINTLN>("'PHP',");
Ā Ā Ā <PRINTLN>("'Python',");
Ā Ā Ā <PRINTLN>("'C',");
Ā Ā Ā <PRINTLN>("'DOTNET',");
Ā Ā Ā <PRINTLN>("'JAVA',");
Ā Ā Ā <PRINTLN>("'GO',");
Ā Ā Ā <PRINTLN>("'Angularjs',");
Ā Ā Ā <PRINTLN>("'Android',");
Ā Ā Ā <PRINTLN>("'Bootstrap.js',");
Ā Ā Ā <PRINTLN>("'JavaScript'");
Ā Ā Ā <PRINTLN>("]");
Ā
//Ā addĀ theĀ dataĀ values
Ā
Ā
HTML.displayhtml("autocomplete2.html");//Ā nowĀ you declareĀ HTML.displayhtml toĀ loadĀ autocomplete2.html
Ā Ā Ā Ā Ā Ā Ā Ā
Ā
Ā
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
}
Ā
š HTML File (autocomplete2.html)
Autocomplete Example
autocomplete2.html
;
Ā Ā Ā Ā $( "#tags" ).autocomplete({
Ā Ā Ā Ā Ā Ā source: availableTags
Ā Ā Ā Ā });
Ā Ā } );
Ā Ā </script>
</head>
<body>
Ā
<div class="ui-widget">
Ā Ā <label for="tags">Tags: </label>
Ā Ā <input id="tags">
</div>
Ā
Ā
</body>
</html>
Tags:
š„ Input
A list of programming languages is added to the list box.
š¤ Output
When you type a letter (e.g., J), the autocomplete will suggest Java,OakJava7
==============================================================================================================
                                   ⨠Unit 2: How a Normal Web Application Works in Dotweb5.0 āØ
====================================================================================================================
# ⨠Unit 2: How a Normal Web Application Works in Dotweb5.0 āØ
## š Overview
In **Dotweb5.0**, a normal web application works with two types of extensions:
- **`.scroll`** ā Common extension for Dotweb5.0 and OakJava7, accepted by **ScrollServer**.Ā Ā
Ā Ā Used for constructing the **first webpage application**.Ā Ā
- **`.exe`** ā Used as a **second-page application**, but only in **Dotweb5.0 Professional Edition**.Ā Ā
In the **Enterprise Edition**, `.scroll` is used for the first page, while the second page is a **Logic Page** (not `.exe`).Ā Ā
---
## š Workflow of a Dotweb5.0 Web Application
1. The user submits a form (e.g., for insertion or login).Ā Ā
2. The request goes to the **Logic Page**, which displays the information provided in the registration page.Ā Ā
3. Data can be printed in a **table format**.Ā Ā
4. When **wnosql DB** is used, all requested values (via wnosql query) are listed on the Logic Page.Ā Ā
5. Form field values are not stored in the browser. Instead, they are securely saved in aĀ file, ensuring that sensitive dataĀ
remains protected and cannot be exposed outside the application environment.
**J7Cookie** is different from a normal cookie (explained in the Cookies chapter).Ā Ā
---
## š Example: Dotweb5.0 Web Application
**File: `jindex1.web`**
---
### š Security Setup
```dotweb5
<WEB>
// Load Security files
<USE> Security;
// Dotweb5 package
<PACK> web5array
```
---
### šļø Program Structure
```dotweb5
<CLASS> Program {
Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā <TRY> {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("formdemowsql21.html");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Add form field values toĀ StringĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā string fieldsname ="name1,uname1,password1,state1,coun<TRY>1,NOT";
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<!DOCTYPE html>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BODY bgcolor=pink>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<form>");
```
---
### š Handling Form Data
- **Dotweb5.Lib.AddDotWebJ7Request** retrieves form fields from `jindex1j7.dsn`.Ā Ā
- The `.dsn` file is dynamically created when navigating to the next webpage.Ā Ā
- Example:Ā Ā
Ā Ā ```dotweb5
-- Here weĀ followĀ shortcut methodĀ which is Ā Dotweb5.Lib.AddDotWebJ7Request
-- whereĀ fieldsname contains fields string fieldsname= "name1,uname1,password1,state1,coun<TRY>1,NOT"
-- isĀ passedĀ to the Dotweb5.Lib.AddArrayListData(fieldsname) method andĀ it is automaticallyĀ added to arraylistĀ
-- present in the methodĀ Dotweb5.Lib.AddArrayListData(fieldsname).
Ā Ā OJ7Lib.J7ArrayList armg= Dotweb5.Lib.AddDotWebJ7Request("jindex1j7.dsn" ,Dotweb5.Lib.AddArrayListData(fieldsname),5,1 );
Ā Ā ```
Ā Ā - `5` ā Number of fields in the form.Ā Ā
Ā Ā - `1` ā Stores all field values.Ā Ā
Ā Ā - If `2` is used instead of `1`, only selected fields (name, password, country) are stored.Ā Ā
---
### š Displaying Data in Table Format
```dotweb5
<PRINTLN>("<table bgcolor=gold>");
<PRINTLN>("<tr>");
<PRINTLN>("Ā <th>Name</th>");
<PRINTLN>("Ā <th>Username</th>");
<PRINTLN>("Ā <th>Password</th>");
<PRINTLN>("Ā <th>State</th>");
<PRINTLN>("Ā <th>Country</th>");
<PRINTLN>(" </tr>");
```
---
### ā Validation Logic
- The program validates:
Ā Ā - **Name** = "Admin"Ā Ā
Ā Ā - **Password** = "password"Ā Ā
If correct ā Displays user details in a table with a **āValid Userā** message.Ā Ā
If incorrect ā Displays **āInvalid Userā** message.Ā Ā
---
### āļø Exception Handling
```dotweb5
<CATCH> (Exception e) {
Ā Ā Ā Ā <PRINTLN>("Error.... " + e);
}
<Finally> {
Ā Ā Ā Ā <PRINTLN>("The Finally block is executed...");
}
```
---
š Complete Code for the given Example: Dotweb5.0 Web Application
// jindex1.web
// ========================================
// Example Dotweb5.0 Web Application
// ========================================
<WEB>
Ā Ā Ā Ā // Load Security files
Ā Ā Ā Ā <USE> Security;
Ā Ā Ā Ā
Ā Ā Ā Ā // Dotweb5 package
Ā Ā Ā Ā <PACK> web5array;
Ā Ā Ā Ā <CLASS> Program {
Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <TRY> {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Display the HTML form
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("formdemowsql21.html");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Initialize form field values to string
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā string fieldsname ="name1,uname1,password1,state1,coun<TRY>1,NOT";
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Print basic HTML structure
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<!DOCTYPE html>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<html>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<body bgcolor='pink'>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<form>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā /*
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā -- Here weĀ followĀ shortcut methodĀ which is Ā Dotweb5.Lib.AddDotWebJ7Request
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā -- whereĀ fieldsname contains fields string fieldsname= "name1,uname1,password1,state1,coun<TRY>1,NOT"
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā -- isĀ passedĀ to the Dotweb5.Lib.AddArrayListData(fieldsname) method andĀ it is automaticallyĀ added to arraylistĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā -- present in the methodĀ Dotweb5.Lib.AddArrayListData(fieldsname).
Ā Ā OJ7Lib.J7ArrayList armg= Dotweb5.Lib.AddDotWebJ7Request("jindex1j7.dsn" ,Dotweb5.Lib.AddArrayListData(fieldsname),5,1 );
Ā Ā ```
Ā Ā - `5` ā Number of fields in the form.Ā Ā
Ā Ā - `1` ā Stores all field values.Ā Ā
Ā Ā - If `2` is used instead of `1`, only selected fields (name, password, country) are stored.Ā Ā
Ā Ā
*/
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // The .dsn file is dynamically created when navigating to the next page
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā OJ7Lib.J7ArrayList armg= Dotweb5.Lib.AddDotWebJ7Request("jindex1j7.dsn" ,Dotweb5.Lib.AddArrayListData(fieldsname),5,1 );
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Build table to display results
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<table bgcolor='gold'>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Name</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Username</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Password</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>State</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Country</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Validate user credentials
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i = 0; i < armg.size() - 1; i += 4) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String name Ā Ā = armg.get(i).ToString();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String username = armg.get(i + 1).ToString();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String password = armg.get(i + 2).ToString();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String stateĀ Ā = armg.get(i + 3).ToString();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String countryĀ = armg.get(i + 4).ToString();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Check if credentials are valid
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā if (name.Equals("Admin") && password.Equals("password")) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + name + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + username + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + password + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + state + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + country + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<br><marquee>Valid User!</marquee><br>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā } else {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<br><marquee>Invalid User!</marquee><br>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā break;
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Close table and form
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</table>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</form>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</body>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</html>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <CATCH> (Exception e) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Error: " + e);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <Finally> {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The Finally block is executed...");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā }
š Dotweb5.0 Web Application ā View PartĀ
formdemowsql21.html
<html>
Ā Ā <body>
Ā Ā Ā Ā <form action="http://localhost:9000/jindex1.web5" method="post">
Ā Ā Ā Ā Ā Ā <table align="center" border="3" width="500" height="500" bgcolor="lightgreen">
Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā <!-- Title Row -->
Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <h2>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <a href="#chapter1">
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <center>Enter Your Form Details</center>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </a>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </h2>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </td>
Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā Ā Ā <!-- Input Fields -->
Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <p>Enter Your Name:Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <input type="text" name="name1" size="25" />
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </p>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </td>
Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <p>Enter Your Username:Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <input type="text" name="uname1" size="15" />
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </p>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </td>
Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <p>Enter Your Password:Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <input type="password" name="password1" size="25" />
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </p>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </td>
Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <p>Choose Your State:Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <input type="text" name="state1" size="15" />
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </p>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </td>
Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <p>Choose Your Country:Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <input type="text" name="country1" size="15" />
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </p>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </td>
Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā Ā Ā <!-- Register Section -->
Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <h2>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <a href="#chapter2">REGISTER</a>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </h2>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </td>
Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā Ā Ā <!-- Submit and Reset Buttons -->
Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <input type="submit" name="Click" value="Submit" />
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <input type="reset" name="Clear" value="Clear" />
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </td>
Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā </table>
Ā Ā Ā Ā </form>
Ā Ā </body>
</html>
## š Key Takeaways
1. Dotweb5.0 usesĀ for the first page and a Logic Page for the second.
2. .exe files are only supported in the Professional Edition, not in the Enterprise Edition.
3. The Logic Page processes form submissions, displays registration data, and interacts with wnosql DB queries.
4. Validation ensures secure login and controlled data display.
5. Form field values are not stored in the browser. Instead, they are securely saved in aĀ file,
Ā Ā Ā Ā Ā Ā Ā Ā ensuring that sensitive data remains protected and cannot be exposed outside the application environment.
6. J7Cookie is different from a normal cookie (explained in the Cookies chapter).
7. Exception handling ensures robustness and reliability in the application workflow.
---
# āļø Running the Scroll Server in Dotweb5.0 āļø
---
## š Starting the Server
To run the **Scroll Server** in Dotweb5.0, follow these steps:
1. Navigate to the correct directory.Ā Ā
2. Type the command:Ā Ā
Ā Ā Ā ```
Ā Ā Ā ScrollServer1.0.3-EnterpriseEditionv.1.exe --Start
Ā Ā Ā ```
3. Alternatively, you can use the **EnlightEditor** to run Dotweb5.0 web files.Ā Ā
---
## š Configuration File (params.txt)
In the `params.txt` file, you must specify the correct directory path.Ā Ā
Here is an example configuration:
```
############################################################################
#Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā #
#Ā Ā Ā Ā Ā Ā Ā Configuration File for WILMIX CAT Web ServerĀ Ā Ā Ā Ā Ā Ā Ā #
#Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā #
############################################################################
# Directive ServerRoot holds the path of the publication directory
ServerRoot d:\WOJ3\project\bin\apps\wilmix
# Directive Port contains the listening server port number
Port 9000
# Directive Welcome specifies the welcome page
Welcome /
# Directive Icons contains the virtual directory name where server icons are located
Icons d:\WOJ3\project\bin\apps\wilmix
# Directive LogFile indicates the path of the server log file
LogFile 10.29.153.50
# Path for the location of the WebServer
Serverpath d:\WOJ3\project\bin\apps\wilmix
# Server validity time
Validitytime 15/05/2027
# Server status (on/off); type Dotweb3.0 code if on
ServerStatus jit-https-77plJSTAR123$$
```
---
## š Password Information
The password for the Scroll Server is:
```
jit-https-77plJSTAR123$
```
---
## š Key Notes
- Always ensure the **directory path** in `params.txt` matches your project location.Ā Ā
- The **Port** directive defines the serverās listening port (default: 9000).Ā Ā
- The **ServerStatus** directive must be set correctly for the server to run.Ā Ā
- The password is required for secure access to the Scroll Server.Ā Ā
Hereās a clear **stepābyāstep startup guide** for running the Scroll Server in Dotweb5.0, written in checklist format so you can follow it easily:
---
# ā StepābyāStep Guide to Running Scroll Server
---
## 1. š Navigate to the Directory
- Open your terminal or command prompt.Ā Ā
- Go to the directory where **ScrollServer1.0.3-EnterpriseEditionv.1.exe** is located.Ā Ā
Ā Ā Example:Ā Ā
Ā Ā ```
Ā Ā cd d:\WOJ3\project\bin\apps\wilmix
Ā Ā ```
---
## 2. ā¶ļø Start the Scroll Server
- Run the following command:Ā Ā
Ā Ā ```
Ā Ā ScrollServer1.0.3-EnterpriseEditionv.1.exe --Start
Ā Ā ```
- Alternatively, you can use **EnlightEditor** to run Dotweb5.0 web files.
---
## 3. š Configure params.txt
- Open the `params.txt` file.Ā Ā
- Ensure the following directives are correctly set:
```
ServerRoot d:\WOJ3\project\bin\apps\wilmix
Port 9000
Welcome /
Icons d:\WOJ3\project\bin\apps\wilmix
LogFile 10.29.153.50
Serverpath d:\WOJ3\project\bin\apps\wilmix
Validitytime 15/05/2020
ServerStatus jit-https-77plJSTAR123$$
```
---
## 4. š Password Setup
- The password for the Scroll Server is:Ā Ā
Ā Ā ```
Ā Ā jit-https-77plJSTAR123$
Ā Ā ```
- Keep this password secure, as it is required for server authentication.
---
## 5. š Verify Server Status
- After starting, check the server log file (`LogFile`) to confirm it is running.Ā Ā
- Ensure the **Port (9000)** is listening.Ā Ā
- Confirm that the **ServerStatus** directive is set to `on` (Dotweb3.0 code).Ā Ā
---
## 6. š Access the Web Application
- Open a browser and go to:Ā Ā
Ā Ā ```
Ā Ā http://localhost:9000/
Ā Ā ```
- You should see the **welcome page** or your configured Dotweb5.0 application.
---
## ⨠Quick Checklist
- [ ] Navigate to correct directoryĀ Ā
- [ ] Run `ScrollServer...exe --Start`Ā Ā
- [ ] Configure `params.txt` properlyĀ Ā
- [ ] Secure the passwordĀ Ā
- [ ] Verify server logs and portĀ Ā
- [ ] Access via browserĀ Ā
---
# ā¹ļø Stopping the Scroll Server
To stop the **Scroll Server** in Dotweb5.0:
- Simply press **CTRL + C** in the terminal or command prompt window where the server is running.Ā Ā
- This command will terminate the server process and shut it down safely.Ā Ā
---
## š Key Note
Always ensure you stop the server properly using **CTRL + C** before closing the terminal, to avoid leaving background processes running.Ā Ā
---
šø Note on Screenshot
Note: This screenshot shows the first page (Scroll Page) and the second page (Logic Page) of the Dotweb5.0 application.
===============================================================================================================
šø Note on Screenshot
Note: The screenshot of the Dotweb5.0 application with the Scroll Server Welcome Page is shown below.
If you don't typeĀ http://localhost:9000/index.html or Ā you type wrongly likeĀ http://localhost:9000/index
it will displayĀ "Page Not Found" error.Ā
==============================================================================================================
Ā Ā Ā š Sorting Objects in Dotweb5.0Ā
# š Sorting Objects in Dotweb5.0Ā Ā
### A Demonstration with Employee and Student ClassesĀ Ā
---
## š ScenarioĀ Ā
In my scenario:Ā Ā
1. I created an **Employee class** which contains the fields: `Id`, `Name`, and `Salary`.Ā Ā
Ā Ā Ā - I want to sort the employees based on:Ā Ā
Ā Ā Ā Ā Ā - **Name**Ā Ā
Ā Ā Ā Ā Ā - **Salary**Ā Ā
2. I created a **Student class** which contains the fields: `StudentId`, `Name`, `Class`, and `TotalMarks`.Ā Ā
Ā Ā Ā - I want to sort the students based on **Total Marks**.Ā Ā
---
This program illustrates how to **sort objects dynamically** in Dotweb5.0 using a **generic BubbleSort method**. The example covers two scenarios:Ā Ā
1. **Employee Class** ā Sorted by *Name* and *Salary*Ā Ā
2. **Student Class** ā Sorted by *Total Marks*Ā Ā
3. **Use Dotweb5.0Ā Web1.0 Theme only
---
## š Program StructureĀ Ā
- **Employee Class**Ā Ā
Ā Ā - Fields: `Id`, `Name`, `Salary`Ā Ā
- **Student Class**Ā Ā
Ā Ā - Fields: `StudentId`, `Name`, `Class`, `TotalMarks`Ā Ā
- **Program Class**Ā Ā
Ā Ā - Contains the `main()` methodĀ Ā
Ā Ā - Demonstrates sorting and displays results in **HTML card format**Ā Ā
---
## āļø Sorting LogicĀ Ā
- The program uses:Ā Ā
Ā Ā - `SortedType.SortByObject.BubbleSort()`Ā Ā
Ā Ā - A **lambda selector** (`e @L e.Name`, `e @L e.Salary`, `s @L s.TotalMarks`)Ā Ā
- This makes the sorting **generic and reusable** for any object type.Ā Ā
---
## šØ Output PresentationĀ Ā
The results are displayed with **HTML styling** for clarity and attraction:Ā Ā
- **Card Layouts** ā neatly separate each sorted result.Ā Ā
- **Headings and Titles** ā emphasize the sorting criteria.Ā Ā
- **Line Breaks** ā improve readability.Ā Ā
---
š GUI HTML forĀ this given SortByObjects.webĀ program is
Sortingdecasc.html
<head>
Ā Ā <title>Dotweb5.0 Theme</title>
//Calling WEB1.0 Style Sheet for DOTWEB5.0 Theme
<link rel="stylesheet" href="http://localhost:8082/DefaultThemedotweb5.WS">
</head>
<BODY>
<div class="container">
Ā Ā Ā Ā <h2>Sort by Employee Name andĀ Employee Salary and Sort By Student Total Marks </h2>
---
-
## š Dotweb5.0 CodeĀ Ā
**File:** `SortByObjects.web`Ā Ā
```dotweb5
<WEB>
Ā <USE>Ā format;
<PACK> sorting
{
public <CLASS> Employee
{
Ā Ā Ā Ā public int Id;
Ā Ā Ā Ā public string Name;
Ā Ā Ā Ā public double Salary;
}
// Example Student class
public <CLASS> Student
{
Ā Ā Ā Ā public int StudentId;
Ā Ā Ā Ā public string Name;
Ā Ā Ā Ā public string Class;
Ā Ā Ā Ā public int TotalMarks;
}
<CLASS> Program
{
Ā Ā Ā Ā public void main()
Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Employee[] employees = {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā new Employee { Id = 1, Name = "Charlie", Salary = 5000 },
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā new Employee { Id = 2, Name = "Alice", Salary = 7000 },
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā new Employee { Id = 3, Name = "Bob", Salary = 6000 }
Ā Ā Ā Ā Ā Ā Ā Ā };
Ā Ā Ā Ā Ā Ā Ā Ā // Sort employees by Name
Ā Ā Ā Ā Ā Ā Ā Ā SortedType.SortByObject.BubbleSort(employees, e @L e.Name);
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<HTML>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // J7HTML will print one blank line for the Html contents
Ā Ā Ā Ā Ā Ā Ā Ā J7HTML.displayhtml("Sortingdecasc.html");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<div <CLASS>=\"card\">");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Employees sorted by Name:");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā foreach (var emp in employees)
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(emp.Id+ " - "+ emp.Name +" - "+ emp.Salary+" | ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</div>");
Ā Ā Ā Ā Ā Ā Ā Ā // Sort employees by Salary
Ā Ā Ā Ā Ā Ā Ā Ā SortedType.SortByObject.BubbleSort(employees, e @L e.Salary);
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<div <CLASS>=\"card\">");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("\nEmployees sorted by Salary:");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā foreach (var emp in employees)
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(emp.Id+" - "+ emp.Name+" - "+ emp.Salary +" | ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</div>");
Ā Ā Ā Ā Ā Ā Ā Ā // Now with Students
Ā Ā Ā Ā Ā Ā Ā Ā Student[] students = {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā new Student { StudentId = 101, Name = "David", Class = "10A", TotalMarks = 450 },
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā new Student { StudentId = 102, Name = "Eva", Class = "10B", TotalMarks = 480 },
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā new Student { StudentId = 103, Name = "Frank", Class = "10A", TotalMarks = 420 }
Ā Ā Ā Ā Ā Ā Ā Ā };
Ā Ā Ā Ā Ā Ā Ā Ā // Sort students by TotalMarks
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<div <CLASS>=\"card\">");
Ā Ā Ā Ā Ā Ā Ā Ā SortedType.SortByObject.BubbleSort(students, s @L s.TotalMarks);
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("\nStudents sorted by Total Marks:");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā foreach (var stu in students)
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(stu.StudentId+" - "+ stu.Name +" - "+ stu.Class +" - "+stu.TotalMarks+" | ");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</div>");
Ā Ā Ā Ā }
}
}
```
---
## šØ OutputĀ
==============================================================================================================
Sort by Employee Name andĀ SalaryĀ andĀ Sort by StudentĀ Total MarksĀ usingĀ Dotweb5.0 Theme
==============================================================================================================
### šĀ Ā DesignĀ a Ā ElevatorĀ usingĀ DOTWEB5.0
# š Elevator Simulation in Dotweb5.0Ā Ā
### š ScenarioĀ Ā
An elevator begins at the **First Floor**, waits for **10 seconds**, then the door closes and it moves to the **Second Floor**.Ā Ā
At each floor:Ā Ā
- The **door opens**Ā Ā
- A **horn sound** is heardĀ Ā
- The elevator **waits for 10 seconds**Ā Ā
- The **door closes**Ā Ā
This continues until the elevator reaches the **Fifth Floor**, where it again waits for 10 seconds before closing the door.Ā Ā
---
## š¢ First FloorĀ Ā
- Door opensĀ Ā
- Horn sound heardĀ Ā
- Door remains open for 10 secondsĀ Ā
- Door closesĀ Ā
---
## š¢ Second FloorĀ Ā
- Door opensĀ Ā
- Horn sound heardĀ Ā
- Door remains open for 10 secondsĀ Ā
- Door closesĀ Ā
---
## š¢ Third FloorĀ Ā
- Door opensĀ Ā
- Horn sound heardĀ Ā
- Door remains open for 10 secondsĀ Ā
- Door closesĀ Ā
---
## š¢ Fourth FloorĀ Ā
- Door opensĀ Ā
- Horn sound heardĀ Ā
- Door remains open for 10 secondsĀ Ā
- Door closesĀ Ā
---
## š¢ Fifth FloorĀ Ā
- Door opensĀ Ā
- Horn sound heardĀ Ā
- Door remains open for 10 secondsĀ Ā
- Door closesĀ Ā
---
### ⨠Key HighlightsĀ Ā
- **Horn Sound**: Signals arrival at each floor.Ā Ā
- **Timed Wait**: Ensures passengers have 10 seconds to enter or exit.Ā Ā
- **Sequential Flow**: Elevator progresses floor by floor until the fifth.Ā Ā
- **Decorative Output**: Each floorās actions are displayed inside a **card layout** for clarity.Ā Ā
### š DOTWEB5.0 Program For ElevatorĀ
<WEB>
Ā <USE> Java7sound;Ā
<USE>Ā format;Ā
<USE> System.Threading;
<PACK> Elevator
{
Ā Ā Ā
Ā Ā Ā Ā <CLASS> Lifts
Ā Ā Ā {
Ā Ā Ā Ā Ā Ā public void main()
Ā Ā Ā Ā Ā Ā {
<PRINTLN>("<HTML>");
int floorno=1;
Ā Ā Ā Ā Ā Ā Ā Ā J7HTML.displayhtml("Sortingdecasc.html");
Ā
ifĀ (floorno==1)
{
<PRINTLN>("<div <CLASS>=\"card\">");
Ā Ā Ā Ā <PRINTLN>("First floorĀ doorĀ open");
<PRINTLN>("<BR><BR>");
Program.java7sound();
<PRINTLN>("<BR><BR>");
for (int i = 0; i < 5; i++)
Ā Ā Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Door open for 2 seconds."); <PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Thread.Sleep(2000);
Ā Ā Ā Ā Ā Ā Ā Ā }
<PRINTLN>("<BR><BR>");
Ā Ā Ā Ā
Ā Ā Ā Ā <PRINTLN>("First floorĀ doorĀ closed");
<PRINTLN>("</div>");
}
<PRINTLN>("<BR><BR></div>");
floorno++;
Ā <PRINTLN>("<div <CLASS>=\"card\">");
Ā ifĀ (floorno==2)
{
Ā Ā Ā Ā <PRINTLN>("Second floorĀ doorĀ open");
Program.java7sound();
for (int i = 0; i < 5; i++)
Ā Ā Ā Ā Ā Ā Ā Ā {
<PRINTLN>("Door open for 2 seconds.");<PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Thread.Sleep(2000);
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā
Ā Ā Ā Ā <PRINTLN>("Second floorĀ doorĀ closed");
}
<PRINTLN>("<BR><BR></div>");
floorno++;
Ā <PRINTLN>("<div <CLASS>=\"card\">");
ifĀ (floorno==3)
{
Ā Ā Ā Ā <PRINTLN>("Third floorĀ doorĀ open");
Program.java7sound();
<PRINTLN>("<BR><BR>");
for (int i = 0; i < 5; i++)
Ā Ā Ā Ā Ā Ā Ā Ā {
<PRINTLN>("Door open for 2 seconds.");<PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Thread.Sleep(2000);
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā
Ā Ā Ā Ā <PRINTLN>("Third floorĀ doorĀ closed");
}
<PRINTLN>("<BR><BR></div>");
floorno++;
Ā <PRINTLN>("<div <CLASS>=\"card\">");
ifĀ (floorno==4)
{
Ā Ā Ā Ā <PRINTLN>("Fourth floorĀ doorĀ open");
Program.java7sound();
<PRINTLN>("<BR><BR>");
for (int i = 0; i < 5; i++)
Ā Ā Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Door open for 2 seconds.");<PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Thread.Sleep(2000);
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā
Ā Ā Ā Ā <PRINTLN>("Fourth floorĀ doorĀ closed");
}
<PRINTLN>("<BR><BR></div>");
floorno++;
Ā <PRINTLN>("<div <CLASS>=\"card\">");
ifĀ (floorno==5)
{
Ā Ā Ā Ā <PRINTLN>("Fifth floorĀ doorĀ open");
<PRINTLN>("<BR><BR>");
Program.java7sound();
for (int i = 0; i < 5; i++)
Ā Ā Ā Ā Ā Ā Ā Ā {
<PRINTLN>("Door open for 2 seconds.");<PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Thread.Sleep(2000);
Ā Ā Ā Ā Ā Ā Ā Ā }
<PRINTLN>("<BR><BR>");
Ā Ā Ā Ā
Ā Ā Ā Ā <PRINTLN>("Fifth floorĀ doorĀ closed");
Ā <PRINTLN>("</div>");
}
<PRINTLN>("</body></HTML>");
Ā Ā
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
}
### š Output For Elevator
Hereās a polished version of your explanation with standard English and attractive headings to make it clear and professional:
In the given .web Ā program, we are invoking an HTML file (j7UserLogin.html) using the following structure:
<WEB>
<PACK> ScrollServer
{
Ā Ā Ā <CLASS> Programs
Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā public void main()
Ā Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <TRY>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("j7UserLogin.html");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <CATCH> (Exception e)
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Error.... " + e);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <Finally>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The Finally block is executed...");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
}
This program demonstrates exception handling with <TRY>, <CATCH>, and <Finally> blocks while displaying the j7UserLogin.html page.
<head>
Ā Ā Ā Ā <title>User Login</title>
Ā Ā Ā Ā <link rel="stylesheet" href="http://localhost:8082/modelbox1.WS">
</head>
The page title is User Login.
A Web1.0 style sheet (modelbox1.WS) is invoked from the local server ie) Web1.0 Wilmix cat Server
<body onLoad="disableClick()" oncontextmenu="return false"Ā
Ā Ā Ā Ā Ā Ā background="https://picsum.photos/200/300/?random" bgcolor="gold">
Security features: Right-click is disabled, and clicks are restricted.
Background: A random image is loaded with a golden background color.
<button onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Sign Up</button>
<div id="id01" class="modal">
Ā Ā Ā <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
Ā Ā Ā <form class="modal-content" action="http://localhost:9000/OakJ7Process.web5" method="post">
Ā Ā Ā Ā Ā Ā Ā <div class="container">
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <h2><a href="#chapter1">Enter your Details</a></h2>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <p><label> User Name: <input type="text" name="uname" size="25" /></label></p>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <p><label> Password: <input type="password" name="password" size="15" /></label></p>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <div class="clearfix">
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <input type="submit" name="Click">
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <input type="reset" name="Clear">
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </div>
Ā Ā Ā Ā Ā Ā Ā </div>
Ā Ā Ā </form>
</div>
Modal Window: Displays a sign-up form when the button is clicked.
Form Action: Submits data to OakJ7Process.web5 running on port 9000.
Fields: Username and password input fields with submit/reset options.
<div class="container" style="background-color:#f1f1f1">
Ā Ā Ā <p align="center"> Jemin Information Technology 2024 (C) All Rights Reserved </p>
</div>
A footer with copyright.
<script>
var modal = document.getElementById('id01');
window.onclick = function(event) {
Ā Ā Ā Ā if (event.target == modal) {
Ā Ā Ā Ā Ā Ā Ā Ā modal.style.display = "none";
Ā Ā Ā Ā }
}
</script>
Ensures the modal closes when clicking outside of it.
Dotweb5.0 + Web1.0 Integration: Demonstrates how modern templates can invoke legacy-style sheets (.WS).
Robust Exception Handling: Java7 program ensures errors are caught and handled gracefully.
User-Friendly Design: Modal-based login form with clear input fields.
Security Features: Disabled right-click and restricted clicks for protection.
Professional Footer: Branding and rights reserved notice.
===============================================================================================================
āØĀ OUTPUT
=============================================================================================================
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā š Dotweb5.0 Advanced Concepts ā Part 1 (With Example)
=============================================================================================================
OakJava7 (Java7.0), also known as OJ7, is a powerful collection framework that integrates with Dotweb5.0. It allows developers to insert, update, and merge data seamlessly with executables.
To store an ArrayList inside the Java7.0 collection memory, use:
Java7Collection.InsertQUERY(<String data>);
This ensures your dynamic list data is preserved in the collection memory.
You can merge the output of an executable (e.g., Elevator.exe) with the inserted ArrayList:
Java7Collection.QUERY(<String data>, "<application.exe>");
This feature highlights integration between program data and external applications.
To fetch previously stored data from the Java7 collection and place it into the ArrayList at index 0:
Java7Collection.QUERY();
This demonstrates data persistence and retrieval.
The Box.Java7 program showcases:
Object creation (Box1, Box2)
Volume calculation
ArrayList operations (add, remove, search, update)
Java7Collection integration
The program produces:
š List Output ā Results of ArrayList operations
š Elevator Output ā Merged executable output
Below is a sample program demonstrating these advanced OakJava7 features.
Box1.java7
<JAVA>
// CUTIL Package
<USE> CUTIL;
<PACK> BoxApplication
{
Ā Ā Ā <CLASS> Box
Ā Ā Ā {
Ā Ā Ā Ā Ā Ā private double length; Ā // Length of a box
Ā Ā Ā Ā Ā Ā private double breadth;Ā // Breadth of a box
Ā Ā Ā Ā Ā Ā private double height; Ā // Height of a box
Ā Ā Ā Ā Ā Ā public void setLength(double len) { length = len; }
Ā Ā Ā Ā Ā Ā public void setBreadth(double bre) { breadth = bre; }
Ā Ā Ā Ā Ā Ā public void setHeight(double hei) { height = hei; }
Ā Ā Ā Ā Ā Ā public double getVolume() { return length * breadth * height; }
Ā Ā Ā }
Ā Ā Ā <CLASS> Boxtester
Ā Ā Ā {
Ā Ā Ā Ā Ā Ā public void main()
Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Box Box1 <NEW> Box();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Box Box2 <NEW> Box();
Ā Ā Ā Ā Ā Ā Ā Ā Ā double volume;
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Box1 specification
Ā Ā Ā Ā Ā Ā Ā Ā Ā Box1.setLength(6.0);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Box1.setBreadth(7.0);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Box1.setHeight(5.0);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Box2 specification
Ā Ā Ā Ā Ā Ā Ā Ā Ā Box2.setLength(12.0);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Box2.setBreadth(13.0);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Box2.setHeight(10.0);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Volume of Box1
Ā Ā Ā Ā Ā Ā Ā Ā Ā volume = Box1.getVolume();
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Volume of Box1 :" + volume);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Volume of Box2
Ā Ā Ā Ā Ā Ā Ā Ā Ā volume = Box2.getVolume();
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Volume of Box2 :" + volume);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // ArrayList operations
Ā Ā Ā Ā Ā Ā Ā Ā Ā CUTIL.ArrayList x <NEW> CUTIL.ArrayList();
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Initial size is " + x.size());
Ā Ā Ā Ā Ā Ā Ā Ā Ā if (x.isEmpty())
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The list is empty");
Ā Ā Ā Ā Ā Ā Ā Ā Ā else
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The list is not empty");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Insert previous data from Java7Collection
Ā Ā Ā Ā Ā Ā Ā Ā Ā x.add(0, Java7Collection.QUERY());
Ā Ā Ā Ā Ā Ā Ā Ā Ā x.add(1, (6));
Ā Ā Ā Ā Ā Ā Ā Ā Ā x.add(0, (1));
Ā Ā Ā Ā Ā Ā Ā Ā Ā x.add(2, (4));
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("List size is " + x.size());
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The list is " + x);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Switch-case demonstration
Ā Ā Ā Ā Ā Ā Ā Ā Ā String JAVA5 = "Java 5";
Ā Ā Ā Ā Ā Ā Ā Ā Ā String JAVA6 = "Java 6";
Ā Ā Ā Ā Ā Ā Ā Ā Ā String JAVA7 = "Java 7";
Ā Ā Ā Ā Ā Ā Ā Ā Ā int c = 1;
Ā Ā Ā Ā Ā Ā Ā Ā Ā switch (c) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā case 1: <PRINTLN>(JAVA5); break;
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā case 2: <PRINTLN>(JAVA6); break;
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā case 3: <PRINTLN>(JAVA7); break;
Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā <TRY>
Ā Ā Ā Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Java7Collection.InsertQUERY(x.ToString()); // Insert ArrayList into Java7 collection memory
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Java7Collection.QUERY(x.ToString(), "Elevator"); // Merge Elevator.exe output with ArrayList
Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā <CATCH> (<EXE> e) {}
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Index operations
Ā Ā Ā Ā Ā Ā Ā Ā Ā int index = x.indexOf((4));
Ā Ā Ā Ā Ā Ā Ā Ā Ā if (index < 0)
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("4 not found");
Ā Ā Ā Ā Ā Ā Ā Ā Ā else
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The index of 4 is " + index);
Ā Ā Ā Ā Ā Ā Ā Ā Ā index = x.indexOf((3));
Ā Ā Ā Ā Ā Ā Ā Ā Ā if (index < 0)
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("3 not found");
Ā Ā Ā Ā Ā Ā Ā Ā Ā else
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The index of 3 is " + index);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Get elements
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Element at 0 is " + x.get(0));
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Element at 3 is " + x.get(3));
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Remove elements
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(x.remove(1) + " removed");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The list is " + x);
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(x.remove(2) + " removed");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The list is " + x);
Ā Ā Ā Ā Ā Ā Ā Ā Ā if (x.isEmpty())
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The list is empty");
Ā Ā Ā Ā Ā Ā Ā Ā Ā else
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The list is not empty");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("List size is " + x.size());
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
}
Hereās a clear explanation of the Box.Java7 program you shared, focusing on how it demonstrates adding, removing, and updating elements in CUTIL.ArrayList along with integration of Java7Collection:
The program defines two classes:
Box ā Represents a 3D box with length, breadth, and height, and provides methods to calculate its volume.
Boxtester ā Acts as the driver class, testing both the Box class and the advanced OakJava7 collection features (CUTIL.ArrayList and Java7Collection).
Two Box objects (Box1 and Box2) are created.
Their dimensions are set using setter methods.
Volumes are calculated and printed using getVolume().
This part shows basic object-oriented programming in OakJava7.
The program then shifts to collection handling using CUTIL.ArrayList.
x.add(0, Java7Collection.QUERY()); // Inserts previous data from Java7Collection at index 0
x.add(1, (6));
x.add(0, (1));
x.add(2, (4));
Elements are inserted at specific indices.
Notice that inserting at index 0 shifts existing elements forward.
<PRINTLN>("Initial size is " + x.size());
if (x.isEmpty()) <PRINTLN>("The list is empty");
Demonstrates how to check if the list has elements.
Shows dynamic resizing behavior of ArrayList.
Java7Collection.InsertQUERY(x.ToString());Ā
Java7Collection.QUERY(x.ToString(), "Elevator");
The current ArrayList contents are inserted into Java7Collection memory.
Then, the program merges the ArrayList output with an executable (Elevator.exe).
This illustrates updating stored data with new values and combining outputs.
int index = x.indexOf((4));
Finds the index of a given element.
If not found, prints "not found".
<PRINTLN>("Element at 0 is " + x.get(0));
<PRINTLN>("Element at 3 is " + x.get(3));
Accesses elements by index.
Demonstrates random access capability of ArrayList.
<PRINTLN>(x.remove(1) + " removed");
<PRINTLN>(x.remove(2) + " removed");
Removes elements at specified indices.
Shows how the list shrinks and reorders itself after removal.
The program produces:
Box Volumes ā Volume of Box1 and Box2.
ArrayList Operations ā Insertions, removals, size checks, and element retrievals.
Java7Collection Integration ā Previous data retrieval, insertion, and merging with executable output.
Final List State ā Displays the updated list after modifications.
Add ā You can insert new elements or previous stored data into the list.
Remove ā You can delete elements by index, and the list reorganizes itself.
Update ā You can push the current list back into Java7Collection memory, effectively refreshing stored data.
Merge ā You can combine list data with external executable outputs for advanced integration.
Got it ā letās make each heading attractive and engaging so your explanation feels polished and professional. Iāll add a touch of style and emphasis to draw attention to each section:
This program demonstrates object-oriented design with the Box class and advanced collection handling using CUTIL.ArrayList and Java7Collection.
Two Box objects are created, dimensions are set, and volumes are calculated.
This shows the foundation of encapsulation and method usage in OakJava7.
The program highlights how to:
Add elements at specific positions
Check size and emptiness
Display contents dynamically
This section illustrates the flexibility of dynamic lists compared to static arrays.
Using Java7Collection.InsertQUERY() and Java7Collection.QUERY(), the program:
Inserts the current ArrayList into Java7Collection memory
Merges the ArrayList with external executable output (Elevator.exe)
This demonstrates data persistence and integration with external applications.
The indexOf() method is used to locate elements in the list.
If the element is not found, the program prints a clear message.
This shows search functionality within collections.
The get() method retrieves elements by index.
This highlights random access capability, allowing direct retrieval without iteration.
The remove() method deletes elements at specific indices.
After removal, the list automatically reorganizes itself.
This demonstrates dynamic memory management in collections.
The final output includes:
Box volumes (calculated from dimensions)
ArrayList operations (insert, update, remove, search)
Java7Collection integration (previous data + executable merge)
Final list state after all modifications
Add ā Insert new or previous data into the list.
Remove ā Delete elements and watch the list adjust.
Update ā Refresh stored data with current values.
Merge ā Combine list data with external outputs.
š„ļø Ā Output
==============================================================================================================
This section demonstrates how Dotweb5.0 integrates with AngularJS to create interactive forms.
We will build a program (w3j7forms.java7) that displays different messages and titles based on user selection.
Create a file named w3j7forms.java7.
Use AngularJS with three option boxes:
Dogs ā Displays āWelcome to the World of Dogsā with title Dogs
Tutorials ā Displays āLearn from examplesā with title Tutorials
Cars ā Displays āRead about carsā with title Cars
<JAVA>
<PACK> Program5
{
Ā Ā Ā <CLASS> w3Prog
Ā Ā Ā {
Ā Ā Ā Ā Ā Ā public void main()
Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("w3forms.html");
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
}
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body ng-app="">
<form>
Ā Ā Pick a topic:
Ā Ā <input type="radio" ng-model="myVar" value="dogs">Dogs
Ā Ā <input type="radio" ng-model="myVar" value="tuts">Tutorials
Ā Ā <input type="radio" ng-model="myVar" value="cars">Cars
</form>
<div ng-switch="myVar">
Ā Ā <div ng-switch-when="dogs">
Ā Ā Ā Ā Ā <h1>Dogs</h1>
Ā Ā Ā Ā Ā <p>Welcome to the World of Dogs.</p>
Ā Ā </div>
Ā Ā <div ng-switch-when="tuts">
Ā Ā Ā Ā Ā <h1>Tutorials</h1>
Ā Ā Ā Ā Ā <p>Learn from examples.</p>
Ā Ā </div>
Ā Ā <div ng-switch-when="cars">
Ā Ā Ā Ā Ā <h1>Cars</h1>
Ā Ā Ā Ā Ā <p>Read about cars.</p>
Ā Ā </div>
</div>
<p>The ng-switch directive hides and shows HTML sections depending on the value of the radio buttons.</p>
</body>
</html>
The output will be displayed in an attractive format using .soweb styling:
When Dogs is selected ā Title: Dogs, Message: Welcome to the World of Dogs
When Tutorials is selected ā Title: Tutorials, Message: Learn from examples
When Cars is selected ā Title: Cars, Message: Read about cars
This is about How to use Dotweb5.0 with Angularjs..
=========================================================================================================
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā š Integrating DotWeb5.0 and OakJava7 Streams š
==========================================================================================================
# šæ OakJava7 StreamsĀ Ā
### ⨠OverviewĀ Ā
OakJava7 Streams (OakJava7Streams) are designed to **optimize code execution** and simplify iteration. They provide **built-in shortcut functions** that make data traversal faster and more concise compared to traditional streams.Ā Ā
OakJava7Streams emphasize:Ā Ā
- ā” **Performance** ā faster than conventional streamsĀ Ā
- š§© **Shortcut Functions** ā reduce boilerplate codeĀ Ā
- šØ **Beautiful Syntax** ā clean, readable, and expressiveĀ Ā
- š **Flexible Iteration** ā forward or backward traversal in a single statementĀ Ā
---
### š Key Feature ExampleĀ Ā
```oakjava7
<J7ITERATOR>(listtype1, 3, listtype1.size());
```
- `listtype1` ā the list being traversedĀ Ā
- `3` ā indicates backward traversalĀ Ā
- `listtype1.size()` ā specifies the endpointĀ Ā
š In most programming languages, iterating elements requires a `while` loop with multiple lines.Ā Ā
With OakJava7 Streams, iteration is reduced to **one elegant statement**.Ā Ā
---
š Example Programs forĀ Oakjava7 Streams isĀ given below...
oj7stream255.web
<WEB>
//load the util package OJ7UTIL
<USE> OJ7UTIL;
<PACK> console {
Ā public <CLASS> oj7stream255 {
Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Stream()->
Ā Ā Ā Ā Ā // Print line breaks
Ā Ā Ā Ā Ā <PRINTLN>("<BR>"); <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Stream.Generate(() -> {
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>"); <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("----------------------------------------------");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("----------------------------------------------");
Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>"); <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā <J7PRINT>("welcome");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>"); <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā // Example object array
Ā Ā Ā Ā Ā Ā Ā object[] arg12 = {1, 5, 3, 89, 45};
Ā Ā Ā Ā Ā Ā Ā // Example string of comma-separated values
Ā Ā Ā Ā Ā Ā Ā string w1 = "13,5,17,9,11,25,27,131";
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā // Convert comma-separated string to ArrayList using <AUTOBOX_ARRAY>
Ā Ā Ā Ā Ā Ā Ā <OJ7UTIL>.ArrayList list235 = <AUTOBOX_ARRAY>(w1);
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("----------------------------------------------");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>"); <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā // Display object array contents without spaces
Ā Ā Ā Ā Ā Ā Ā <J7ForLoopDisplayt1>(arg12);
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā // Display object array contents with spaces
Ā Ā Ā Ā Ā Ā Ā // Demonstrates minimizing a for-loop to a single statement
Ā Ā Ā Ā Ā Ā Ā <J7ForLoopDisplayt2>(arg12);
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>"); <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā // Use OakJava7 Iterator to traverse list in insertion order
Ā Ā Ā Ā Ā Ā Ā OJ7UTIL.ArrayList ar99t1 = <J7ITERATOR>(list235, 1, 0);
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("List in Insertion Order: <BR>");
Ā Ā Ā Ā Ā Ā Ā <OJ7Displayt2>(ar99t1);
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā // Traverse list in forward order
Ā Ā Ā Ā Ā Ā Ā OJ7UTIL.ArrayList ar991 = <J7ITERATOR>(list235, 2, 0);
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("List in Insertion Order - Front: <BR>");
Ā Ā Ā Ā Ā Ā Ā <OJ7Displayt1>(ar991);
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>"); <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā // Traverse list in backward order
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("List in Insertion Order - Back: <BR>");
Ā Ā Ā Ā Ā Ā Ā OJ7UTIL.ArrayList ar992 = <J7ITERATOR>(list235, 3, list235.size());
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(ar992);
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("----------------------------------------------");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā })->
Ā Ā Ā }->
Ā }}}Ā
### š Built-in OakJava7 Statements (Brief Explanation)Ā Ā
- **`<PRINTLN>`** ā Prints output with line breaksĀ Ā
- **`<J7PRINT>`** ā Prints output without line breaks
- **`<AUTOBOX_ARRAY>`** ā Converts comma-separated strings into ArrayListsĀ Ā
- **`<J7ForLoopDisplayt1>`** ā Displays array contents without spacesĀ Ā
- **`<J7ForLoopDisplayt2>`** ā Displays array contents with spacesĀ Ā
- **`<J7ITERATOR>`** ā Iterates lists in forward or backward orderĀ Ā
- **`<OJ7Displayt1>` / `<OJ7Displayt2>`** ā Displays ArrayList contents in different formatsĀ Ā
---
### š Example Use CasesĀ Ā
- **Forward Iteration** ā `<J7ITERATOR>(list, 2, 0)`Ā Ā
- **Backward Iteration** ā `<J7ITERATOR>(list, 3, list.size())`Ā Ā
- **Insertion Order Display** ā `<OJ7Displayt2>(list)`Ā Ā
---
## š Further ReadingĀ Ā
**Note:**Ā Ā
For more detailed information about OakJava7 Streams, please refer to the **OakJava7 Tutorial when it isĀ released**.Ā Ā
---
Ā Ā š OUTPUT
================================================================================================================
# šāØ **DotWeb5.0 Encryption with OakJava7 ** āØšĀ Ā
===============================================================================================================
## š Program OverviewĀ Ā
This program demonstrates how **DotWeb5.0** integrates with **OakJava7 encryption functions** to securely process text.Ā
It shows both **encryption** and **decryption** operations using concise OakJava7 syntax.Ā Ā
```
# šāØ **DotWeb5.0 Encryption with OakJava7 ** āØšĀ Ā
---
## š Program OverviewĀ Ā
This program demonstrates how **DotWeb5.0** integrates with **OakJava7 encryption functions** to securely process text.Ā
It shows both **encryption** and **decryption** operations using concise OakJava7 syntax.Ā Ā
---
## š Example ProgramĀ Ā
```Dotweb5.0
<WEB>
<PACK> j7security1 {
Ā Ā Ā <CLASS> Prog {
Ā Ā Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Display HTML page with gold background
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<html><body bgcolor=gold");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Encrypt the given text using OakJava7's j7Encrypt function
Ā Ā Ā Ā Ā Ā Ā Ā Ā string sop = j7security.Ojava7Process.j7Encrypt(
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā "wilmix is going1 , cat is going , dog is chasing cat"
Ā Ā Ā Ā Ā Ā Ā Ā Ā );
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Print the encrypted output
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Encrypt=" + sop);
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR><BR><BR><BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("------------------------------------------------------------");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("------------------------------------------------------------");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Encrypt another text string
Ā Ā Ā Ā Ā Ā Ā Ā Ā string sop1 = j7security.Ojava7Process.j7Encrypt(
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā "wilmix is going , cat is going , dog is chasing cat"
Ā Ā Ā Ā Ā Ā Ā Ā Ā );
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Print the encrypted output
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Encrypt=" + sop1);
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR><BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Decrypt the text using OakJava7's Decrypt function
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Decrypt=" + j7security.Ojava7Process.Decrypt());
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR><BR><BR><BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Close HTML body
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</body></html>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("------------------------------------------------------------");
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
}
```
---
## š Brief Explanation of StepsĀ Ā
- **HTML Setup:**Ā Ā
Ā Ā Prints an HTML body with a gold background for styled output.Ā Ā
- **Encryption (j7Encrypt):**Ā Ā
Ā Ā The `j7Encrypt` function takes a plain text string and returns its encrypted format.Ā Ā
- **Output Display:**Ā Ā
Ā Ā Encrypted text is displayed with line breaks and separators for clarity.Ā Ā
- **Decryption (Decrypt):**Ā Ā
Ā Ā The `Decrypt` function is called to convert the encrypted text back to its original form.Ā Ā
- **Final Output:**Ā Ā
Ā Ā Results are shown inside a styled HTML page.Ā Ā
---
Ā Ā š OUTPUT
==========================================================================================================
Ā Ā Ā Ā Ā Ā ā”š **DotWeb5.0 WNOSQL Program with OakJava7 Soweb Template** šā”Ā Ā
===========================================================================================================
---
## š QuestionĀ
**Question:**Ā Ā
Write a **WNOSQL program** to list all the items from the `datastorehg` table using the **OakJava7 Soweb template**.Ā Ā
- Display the results in the format **A1 A2**.Ā Ā
- Calculate the **time taken** to list all the data from `datastorehg`.Ā Ā
- Implement the solution using **DotWeb5.0**.Ā Ā
---
## š» ProgramĀ Ā
```dotweb5
<WEB>
<USE> Security; // Load security packages
<USE> fx; // Load file packages
<WNOSQL> // Load WNOSQL packages for database connections
<PACK> Program8 {
Ā Ā Ā <CLASS> Prog {
Ā Ā Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Read the file path from filepath.txt sequentially
Ā Ā Ā Ā Ā Ā Ā Ā Ā String fpath = fx.FileSequentialAccess.Read("filepath.txt");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Pass the file path to WDBASQLS for database setup
Ā Ā Ā Ā Ā Ā Ā Ā Ā String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", fpath);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Establish connection using WDBASQLS with user credentials
Ā Ā Ā Ā Ā Ā Ā Ā Ā String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Query to list all 3000 records from datastorehg in format A1 A2
Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String qh2 = "SelectAll from datastorehg 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Execute the SelectAll query
Ā Ā Ā Ā Ā Ā Ā Ā Ā wdbaconn.WDBAQUERY(qh2);
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā // Record start time using DateTime
Ā Ā Ā Ā Ā Ā Ā Ā Ā DateTime aDate = DateTime.Now;
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(aDate.ToString("HH:mm:ss"));
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Convert query results into ArrayList format
Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā OJ7Lib.J7ArrayList ar= new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // WDBALIB.WDBAQUERY will return list format , so convert to String format by replacing "[" and "]" with spaces
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String data=WDBALIB.WDBAQUERY(qh2, t).ToString().Replace("[","").Replace("]","");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā //thereĀ are 3004 datas in the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i=0;i< 3004;i++)
// Past the StringĀ data into <AUTOBOX_ARRAY> , which will convert data to Arraylist data by i th elementĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ar.add( i,<AUTOBOX_ARRAY>(data).get(i).ToString());
//<PRINTLN>(ar.get(0));
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Print the data in A1 A2 format using <J7PRINT>
Ā Ā Ā Ā Ā Ā Ā Ā Ā // There are 2 columns andĀ so the arraylist isĀ incremented by 2
Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i = 2; i < ar.size(); i += 2) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Represent ith dataĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Represent i+1 data ie) Next data
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i + 1).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Record end time using DateTime
Ā Ā Ā Ā Ā Ā Ā Ā Ā DateTime aDate1 = DateTime.Now;
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(aDate1.ToString("HH:mm:ss"));
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
}
```
---
## š Explanation of Program StepsĀ Ā
- **Security & Utility Packages:**Ā Ā
Ā Ā Loads required packages for secure database access, utility functions, and file handling.Ā Ā
- **File Path Access:**Ā Ā
Ā Ā Reads the database file path from `filepath.txt` using sequential file access.Ā Ā
- **Database Connection:**Ā Ā
Ā Ā Uses `WDBASQLS` to establish a connection with the datastore using credentials.Ā Ā
- **Query Execution:**Ā Ā
Ā Ā Runs a `SelectAll` query to fetch 3000 records from the `datastorehg` table.Ā Ā
- **Time Measurement:**Ā Ā
Ā Ā Captures the start and end time using `DateTime.Now` to calculate the time taken for listing.Ā Ā
- **Data Listing (A1 A2 Format):**Ā Ā
Ā Ā Iterates through the ArrayList results and prints them in pairs (`A1 A2`) using `<J7PRINT>`.Ā Ā
---
<USE> Security; ā Loads security-related packages.
<USE> fx; ā Loads file-handling packages.
<WNOSQL> ā Loads WNOSQL packages for database connections.
<PACK> Program8 {
Ā Ā Ā <CLASS> Prog {
Ā Ā Ā Ā Ā Ā public void main() {
Defines the main program class and entry point.
String fpath = fx.FileSequentialAccess.Read("filepath.txt");
Reads the file path sequentially from filepath.txt.
This path is later used for database setup.
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", fpath);
Passes the file path to WDBASQLS for database initialization.
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
Establishes a database connection using user credentials.
String qh2 = "SelectAll from datastorehg 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
wdbaconn.WDBAQUERY(qh2);
Defines a query to list 3000 records from datastorehg in A1 A2 format.
Executes the query using WDBAQUERY.
DateTime aDate = DateTime.Now;
<PRINTLN>(aDate.ToString("HH:mm:ss"));
Records and prints the start time.
Later, another timestamp is recorded as the end time.
OJ7Lib.J7ArrayList ar = new OJ7Lib.J7ArrayList();
String data = WDBALIB.WDBAQUERY(qh2, t).ToString().Replace("[","").Replace("]","");
Converts query results into a string format by removing brackets.
Iterates through 3004 records and adds them into an ArrayList using <AUTOBOX_ARRAY>.
for (int i = 2; i < ar.size(); i += 2) {
Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i).ToString());
Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i + 1).ToString());
Ā Ā Ā Ā <PRINTLN>("<BR>");
}
Prints the data in A1 A2 format.
Since there are two columns, the ArrayList is incremented by 2 for each iteration.
DateTime aDate1 = DateTime.Now;
<PRINTLN>(aDate1.ToString("HH:mm:ss"));
Records and prints the end time after query execution and data processing.
Security, file, and WNOSQL packages are loaded for program execution.
The program reads a file path, sets up a database connection, and executes a query to retrieve 3000+ records.
Results are converted into an ArrayList and printed in A1 A2 format.
Start and end times are logged to measure execution duration.
Ā Ā š OUTPUT
=========================================================================================================
---
Ā Ā Ā Ā š DOTWEB5.0 WebApplication AdvancedĀ Concepts : Type - 1
ā”š **DotWeb5.0 WNOSQL Program with OakJava7 Soweb Template, Display 12,000 Ā Ā Ā Records only with inĀ few seconds** šā”Ā Ā
==========================================================================================================
## š Question
**Question:**Ā Ā
Write a **WNOSQL program** to Display 12,000 records from the `datastorehg` table using the **OakJava7 Soweb template**.Ā Ā
- Display the results in the format **A1 A2**.Ā Ā
- Calculate the **time taken** to list all the data from `datastorehg`.Ā Ā
- Implement the solution using **DotWeb5.0**.Ā Ā
- Time should not exceed 3 seconds.
---
## š» ProgramĀ Ā
```dotweb5
```
<WEB>
<USE> Security; // Load security packages
<USE> fx; // Load file packages
<WNOSQL> // Load WNOSQL packages for database connections
<PACK> Program8 {
Ā Ā Ā <CLASS> Prog {
Ā Ā Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Read the file path from filepath.txt sequentially
Ā Ā Ā Ā Ā Ā Ā Ā Ā String fpath = fx.FileSequentialAccess.Read("filepath.txt");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Pass the file path to WDBASQLS for database setup
Ā Ā Ā Ā Ā Ā Ā Ā Ā String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", fpath);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Establish connection using WDBASQLS with user credentials
Ā Ā Ā Ā Ā Ā Ā Ā Ā String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Query to list all 3000 records from datastorehg in format A1 A2
Ā Ā Ā Ā Ā Ā Ā Ā Ā String qh2 = "SelectAll from datastorehg 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Execute the SelectAll query
Ā Ā Ā Ā Ā Ā Ā Ā Ā wdbaconn.WDBAQUERY(qh2);
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Record start time using DateTime
Ā Ā Ā Ā Ā Ā Ā Ā Ā DateTime aDate = DateTime.Now;
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(aDate.ToString("HH:mm:ss"));
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Convert query results into J7ArrayList format
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā OJ7Lib.J7ArrayList ar= new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // WDBALIB.WDBAQUERY will return list format , so convert to String format by replacing "[" and "]" with spaces
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String data=WDBALIB.WDBAQUERY(qh2, t).ToString().Replace("[","").Replace("]","");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā //thereĀ are 3004 datas in the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i=0;i< 3004;i++)
// Past the StringĀ data into <AUTOBOX_ARRAY> , which will convert data to Arraylist data by Ith elementĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ar.add( i,<AUTOBOX_ARRAY>(data).get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Print the data in A1 A2 format using <J7PRINT>
Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i = 2; i < ar.size(); i += 2) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i + 1).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
// Query to list all 3000 records from datastorehg in format A1 A2
Ā Ā Ā Ā Ā Ā Ā Ā Ā String qh3 = "SelectAll from datastorehg 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Execute the SelectAll query
Ā Ā Ā Ā Ā Ā Ā Ā Ā wdbaconn.WDBAQUERY(qh3);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Convert query results into J7ArrayList format
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā OJ7Lib.J7ArrayList ar1= new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // WDBALIB.WDBAQUERY will return list format , so convert to String format by replacing "[" and "]" with spaces
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String data2=WDBALIB.WDBAQUERY(qh3, t).ToString().Replace("[","").Replace("]","");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā //thereĀ are 3004 datas in the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i=0;i< 3004;i++)
// Past the StringĀ data2 into <AUTOBOX_ARRAY> , which will convert data to Arraylist data by Ith elementĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ar1.add( i,<AUTOBOX_ARRAY>(data2).get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Print the data in A1 A2 format using <J7PRINT>
Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i = 2; i < ar1.size(); i += 2) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar1.get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar1.get(i + 1).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
// Query to list all 3000 records from datastorehg in format A1 A2
Ā Ā Ā Ā Ā Ā Ā Ā Ā String qh4 = "SelectAll from datastorehg 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Execute the SelectAll query
Ā Ā Ā Ā Ā Ā Ā Ā Ā wdbaconn.WDBAQUERY(qh4);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Convert query results into J7ArrayList format
Ā Ā Ā Ā Ā Ā OJ7Lib.J7ArrayList ar2= new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // WDBALIB.WDBAQUERY will return list format , so convert to String format by replacing "[" and "]" with spaces
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String data3=WDBALIB.WDBAQUERY(qh4, t).ToString().Replace("[","").Replace("]","");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā //thereĀ are 3004 datas in the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i=0;i< 3004;i++)
// Past the StringĀ data into <AUTOBOX_ARRAY> , which will convert data to Arraylist data by Ith elementĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ar2.add( i,<AUTOBOX_ARRAY>(data3).get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Print the data in A1 A2 format using <J7PRINT>
Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i = 2; i < ar2.size(); i += 2) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar2.get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar2.get(i + 1).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
// Query to list all 3000 records from datastorehg in format A1 A2
Ā Ā Ā Ā Ā Ā Ā Ā Ā String qh5 = "SelectAll from datastorehg 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Execute the SelectAll query
Ā Ā Ā Ā Ā Ā Ā Ā Ā wdbaconn.WDBAQUERY(qh5);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Convert query results into J7ArrayList format
Ā Ā Ā Ā Ā Ā OJ7Lib.J7ArrayList ar3= new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // WDBALIB.WDBAQUERY will return list format , so convert to String format by replacing "[" and "]" with spaces
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String data4=WDBALIB.WDBAQUERY(qh5, t).ToString().Replace("[","").Replace("]","");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā //thereĀ are 3004 datas in the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i=0;i< 3004;i++)
// Past the StringĀ data into <AUTOBOX_ARRAY> , which will convert data to Arraylist data by Ith elementĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ar3.add( i,<AUTOBOX_ARRAY>(data4).get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Print the data in A1 A2 format using <J7PRINT>
Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i = 2; i < ar3.size(); i += 2) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar3.get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar3.get(i + 1).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Record end time using DateTime
Ā Ā Ā Ā Ā Ā Ā Ā Ā DateTime aDate1 = DateTime.Now;
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(aDate1.ToString("HH:mm:ss"));
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
}
---
## š Explanation of Program StepsĀ Ā
- **Security & Utility Packages:**Ā Ā
Ā Ā Loads required packages for secure database access, utility functions, and file handling.Ā Ā
- **File Path Access:**Ā Ā
Ā Ā Reads the database file path from `filepath.txt` using sequential file access.Ā Ā
- **Database Connection:**Ā Ā
Ā Ā Uses `WDBASQLS` to establish a connection with the datastore using credentials.Ā Ā
- **Query Execution:**Ā Ā
Ā Ā Runs a `SelectAll` query to fetch 12000 records from the `datastorehg` tableĀ batch by batch ...
- **Time Measurement:**Ā Ā
Ā Ā Captures the start and end time using `DateTime.Now` to calculate the time taken for listing.Ā Ā
- **Data Listing (A1 A2 Format):**Ā Ā
Ā Ā Iterates through the ArrayList results and prints them in pairs (`A1 A2`) using `<J7PRINT>`.Ā Ā
---**Display 12000 Records with in 3 seconds using the same logic.
Disadvantage of using this forloop repeated 4 times result not in best Time complexity
How will you solve it ? Is it possible?
Ā Yes, that can only be solved using Oakjava7
WeĀ can see it brieflyĀ later ........
Note:Ā Here in this example to display 12,000 records take only few seconds to display in a webpage.
Ā š OUTPUT
============================================================================================================
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā š DOTWEB5.0 WebApplication AdvancedĀ Concepts : Type - 2
==============================================================================================================
# š Question: InvoiceBill Mini ProjectĀ Ā
## š Dotweb5.0 + AngularJS + OakJava7Ā Ā
### QuestionĀ Ā
**Design and implement a Single Page Application (SPA) for an Invoice Bill system using Dotweb5.0, AngularJS, and OakJava7.**Ā Ā
---
## šÆ RequirementsĀ Ā
1. **Frontend (AngularJS):**Ā Ā
Ā Ā Ā - Create an `InvoiceBill.html` form that collects customer details, billing details, product details, and bank details.Ā Ā
Ā Ā Ā - Use AngularJS `ng-model` for two-way data binding.Ā Ā
Ā Ā Ā - Ensure that when the form is submitted, the invoice bill is displayed on the same page (SPA principle).Ā Ā
2. **Backend (OakJava7):**Ā Ā
Ā Ā Ā - Write an `InvoiceBill.web` program that:Ā Ā
Ā Ā Ā Ā Ā - Retrieves submitted form data using `Dotweb5.Lib.AddDotWebJ7Request`.Ā Ā
Ā Ā Ā Ā Ā - Applies business logic to calculate:Ā Ā
Ā Ā Ā Ā Ā Ā Ā - Base amount (`qty Ć rate`)Ā Ā
Ā Ā Ā Ā Ā Ā Ā - CGST (`rate1% of amount`)Ā Ā
Ā Ā Ā Ā Ā Ā Ā - SGST (`rate2% of amount`)Ā Ā
Ā Ā Ā Ā Ā Ā Ā - Total amount after tax.Ā Ā
Ā Ā Ā Ā Ā - Dynamically generates HTML tables to display invoice details (customer, product, tax, and bank information).Ā Ā
Ā Ā Ā Ā Ā - Redirects back to the same page to maintain SPA behavior.Ā Ā
3. **Database Integration (Dotweb5.0 + WNoSQL):**Ā Ā
Ā Ā Ā - Connect to WNoSQL database using secure credentials.Ā Ā
Ā Ā Ā - Split invoice data into two tables:Ā Ā
Ā Ā Ā Ā Ā - **Invoicebill** ā Customer and product details.Ā Ā
Ā Ā Ā Ā Ā - **Invoicebill2** ā Rate, discount, tax, and bank details.Ā Ā
Ā Ā Ā - Insert collected data into respective tables using Dotweb5.0 query methods.Ā Ā
---
## š Expected OutputĀ Ā
- A **Single Page Application** where:Ā Ā
Ā Ā - The user enters invoice details in the AngularJS form.Ā Ā
Ā Ā - The OakJava7 backend processes the data, applies business logic, and stores it in WNoSQL tables.Ā Ā
Ā Ā - The invoice bill is displayed dynamically on the same page with formatted HTML tables.Ā Ā
Ā Ā - The system shows customer details, product details, tax calculations, and bank details.Ā Ā
---
## ā DeliverablesĀ Ā
- **InvoiceBill.html** (AngularJS frontend form).Ā Ā
- **InvoiceBill.web** (OakJava7 backend with Dotweb5.0 integration).Ā Ā
- **Database schema and queries** for WNoSQL storage.Ā Ā
- **Documentation** explaining the workflow: frontend ā backend ā database ā output.Ā Ā
---
---
# š InvoiceBill Project DocumentationĀ Ā
## š Single Page Application (SPA)Ā Ā
### š¹ Definition of SPAĀ Ā
A **Single Page Application (SPA)** is a web application or website that interacts with the user
Ā by dynamically rewriting parts of the current page instead of loading entire new pages from the server.Ā
This approach improves speed, responsiveness, and user experience.
---
# š§¾ Frontend Program: AngularJSĀ Ā
## šÆ PurposeĀ Ā
The frontend collects customer, billing, product, and bank details through a structured form. Once submitted, the data is processed and displayed dynamically on the same page, demonstrating the SPA principle.
## š» File: **InvoiceBill.html**Ā Ā
```html
<!DOCTYPE html>
<html>
<head>
Ā Ā Ā Ā <title>Invoice Bill Entry</title>
Ā Ā Ā Ā <!-- AngularJS Library -->
Ā Ā Ā Ā <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
</head>
<div ng-app="">
<body>
Ā Ā Ā Ā <!-- InvoiceBill Form -->
Ā Ā Ā Ā <form action="http://localhost:9000/InvoiceBill.jclass" method="post">
Ā Ā Ā Ā Ā Ā Ā Ā <table align="center" border="3" width="500" height="500" bgcolor="lightgreen">
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <h2><td><a href="#chapter1"><center>Enter Your Invoice Bill Customer Details</center></a></td></h2>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <!-- Customer Details -->
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Customer Address: <input type="text" name="CADDRESS" ng-model="caddress" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Invoice Number: <input type="number" name="invoiceno" ng-model="invoiceno" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Invoice Date: <input type="text" name="invoicedate" ng-model="invoicedate" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Reverse Charge: <input type="text" name="reversecharge" ng-model="reversecharge" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>State: <input type="text" name="state" ng-model="state" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Code: <input type="text" name="code" ng-model="code" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Name: <input type="text" name="name" ng-model="name" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <!-- Billing Details -->
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Billing Address: <input type="text" name="BADDRESS" ng-model="BADDRESS" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>GSTIN: <input type="text" name="gstin" ng-model="gstin" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>State: <input type="text" name="state1" ng-model="state1" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Code: <input type="text" name="code1" ng-model="code1" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>S.No: <input type="text" name="sno" ng-model="sno" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <!-- Product Details -->
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Product Description: <input type="text" name="productdescription" ng-model="productdescription" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>HSN Code: <input type="number" name="hsncode" ng-model="hsncode" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Quantity: <input type="number" name="qty" ng-model="qty" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Rate: <input type="number" name="rate" ng-model="rate" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Discount: <input type="number" name="discount" ng-model="discount" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Rate1: <input type="number" name="rate1" ng-model="rate1" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Rate2: <input type="number" name="rate2" ng-model="rate2" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <!-- Bank Details -->
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Amount in Words: <input type="text" name="Amountinwords" ng-model="Amountinwords" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Bank Name: <input type="text" name="bname" ng-model="bname" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Bank Account: <input type="text" name="bankaccount" ng-model="bankaccount" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td>Bank IFSC: <input type="text" name="bankifsc" ng-model="bankifsc" /></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <!-- Submit Section -->
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr><td><h2><a href="#chapter2">REGISTER</a></h2></td></tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <tr>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td><input type="submit" name="ClickMe"></td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <td><input type="reset" name="Clear"></td>
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā </tr>
Ā Ā Ā Ā Ā Ā Ā Ā </table>
Ā Ā Ā Ā </form>
</body>
</div>
</html>
```
---
# āļø Backend Program: OakJava7 +Dotweb5.0+ WNoSQLĀ Ā
## šÆ PurposeĀ Ā
The backend processes submitted data, applies business logic for invoice calculation,Ā
stores data in **WNoSQL databases**, and renders the invoice bill in a formatted HTML page.
## š» File: **InvoiceBill.web**Ā Ā
---
# š InvoiceBill Backend Program
## āļø OakJava7 + WNoSQL +Dotweb5.0 ImplementationĀ Ā
InvoiceBill.web
<JAVA>
// use Dotweb5 util packages and Oakjava7 security packages
<USE> Security;
<USE> fx;
// Use Wnosql packages
<WNOSQL>
<PACK> Program8
{
Ā Ā
Ā Ā Ā Ā <CLASS> Prog
Ā Ā Ā {
Ā
Ā
Ā Ā Ā Ā Ā Ā public void main()
Ā Ā Ā Ā Ā Ā {
// Design Invoice Bill form
HTML.displayhtml("Invoicebill.html");
// Add what are the fields you want for preparing Invoice bill
Ā Ā Ā Ā Ā Ā Ā Ā string fields = "CADDRESS,invoiceno,invoicedate,reversecharge,state,code,name,BADDRESS,gstin,state1,code1,sno,productdescription,hsncode,qty,rate,discount,rate1,rate2,Amountinwords,bname,bankaccount,bankifsc,NOT";
<PRINTLN>("<HTML>");
<PRINTLN>("<head> <style>");
<PRINTLN>("table {");
Ā Ā Ā <PRINTLN>(" width:100%;");
<PRINTLN>("}");
<PRINTLN>("table, th, td {");
Ā Ā Ā Ā <PRINTLN>("border: 1px solid black;");
Ā Ā Ā <PRINTLN>(" border-collapse: collapse;");
<PRINTLN>("}");
<PRINTLN>("th, td {");
Ā Ā Ā <PRINTLN>(" padding: 5px;");
Ā Ā Ā <PRINTLN>(" text-align: left;");
<PRINTLN>("}");
<PRINTLN>("table#t01 tr:nth-child(even) {");
Ā Ā Ā <PRINTLN>(" background-color: grey;");
<PRINTLN>("}");
<PRINTLN>("table#t01 tr:nth-child(odd) {");
Ā Ā Ā <PRINTLN>("background-color:yellow;");
<PRINTLN>("}");
<PRINTLN>("table#t01 th {");
Ā Ā Ā <PRINTLN>(" background-color: black;");
Ā Ā Ā Ā <PRINTLN>("color: white;");
<PRINTLN>("}");
<PRINTLN>("</style>");
<PRINTLN>("</head>");
<PRINTLN>("<BODY >");
<PRINTLN>("<form>");
Ā
OJ7Lib.J7ArrayList armg= Dotweb5.Lib.AddDotWebJ7Request("InvoiceBilloj7.dsn" ,Dotweb5.Lib.AddArrayListData(fields),23,1 );
//Design a html page for submiting all the 23 fields data ...
Ā stringĀ CADDRESS=armg.get(0).ToString();
Ā stringĀ invoiceno=armg.get(1).ToString();
Ā stringĀ invoicedate=armg.get(2).ToString();
Ā stringĀ reversecharge=armg.get(3).ToString();
Ā stringĀ state=armg.get(4).ToString();
Ā stringĀ code=armg.get(5).ToString();
Ā stringĀ name=armg.get(6).ToString();
Ā stringĀ BADDRESS=armg.get(7).ToString();
Ā stringĀ gstin=armg.get(8).ToString();
Ā stringĀ state1=armg.get(9).ToString();
Ā stringĀ code1=armg.get(10).ToString();
Ā stringĀ sno=armg.get(11).ToString();
Ā stringĀ productdescription=armg.get(12).ToString();
Ā stringĀ hsncode=armg.get(13).ToString();
Ā stringĀ qty=armg.get(14).ToString();Ā
stringĀ rate=armg.get(15).ToString();
Ā stringĀ discount=armg.get(16).ToString();
Ā stringĀ rate1=armg.get(17).ToString();
Ā stringĀ rate2=armg.get(18).ToString();
Ā stringĀ Amountinwords=armg.get(19).ToString();
Ā stringĀ bname=armg.get(20).ToString();
Ā stringĀ bankaccount=armg.get(21).ToString();
Ā stringĀ bankifsc=armg.get(22).ToString();Ā Ā Ā Ā
// Use OakJava7 Servlet toĀ print the form in webpage
Ā <PRINTLN>("<tableĀ id=t01 width=1027 height=210 border=1 bgcolor=#fff >");
<PRINTLN>(" <tr> ");
Ā Ā Ā
<PRINTLN>(" <tdĀ height=135><div align=center><strong><address> ");
<PRINTLN>(""+CADDRESS);
<PRINTLN>("</address></strong></div></p> <p align=right><strong>TriplicateĀ for</strong></p>");
Ā Ā
<PRINTLN>("Ā <p align=right><strong>Supplier</strong></p></td> ");
Ā
<PRINTLN>(" </tr> ");
Ā Ā
<PRINTLN>("<tr> ");
<PRINTLN>(" <td><div align=center><span <CLASS>=style12>TaxĀ Invoice</span></div></td>");
Ā Ā Ā
Ā
<PRINTLN>(" </tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1 bgcolor=#fff> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā Ā
<PRINTLN>(" <td width=506><strong>Invoice No: </strong>"+invoiceno+"</td> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=503></td> ");
Ā
<PRINTLN>(" </tr> ");
Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā
<PRINTLN>("<td><strong>Invoice date: </strong>"+invoicedate+"</td> ");
Ā Ā Ā Ā
<PRINTLN>("<td> </td> ");
Ā Ā
<PRINTLN>("</tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1 bgcolor=#fff> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=436><strong>Reverse Charge(Y/N):</strong>"+reversecharge+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td width=63> </td> ");
Ā Ā
<PRINTLN>("Ā <td width=505> </td> ");
Ā Ā
<PRINTLN>("</tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1 bgcolor=#fff> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=337><strong>State:</strong>"+ state+"</td> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=94><strong>Code </strong></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=63> "+code+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td width=504> </td> ");
Ā
<PRINTLN>(" </tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1Ā bgcolor=#fff>");
Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=506><div align=center <CLASS>=style13>Bill to Party </div></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=503><div align=center><span <CLASS>=style13>Ship to party </span></div></td> ");
Ā
<PRINTLN>(" </tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1 bgcolor=#fff> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=506><strong>Name:</strong>"+name+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td width=505><strong>Name:</strong>"+name+"</td> ");
Ā
<PRINTLN>(" </tr> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā Ā
<PRINTLN>("<td><strong>Address:</strong>"+ BADDRESS+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td><strong>Address:</strong>"+ BADDRESS+"</td> ");
Ā Ā
<PRINTLN>("</tr> ");
Ā Ā
Ā
<PRINTLN>(" <tr> ");
Ā Ā
<PRINTLN>("Ā <td><strong>GSTIN:</strong>"+gstin+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td><strong>GSTIN:</strong>"+gstin+"</td> ");
Ā
<PRINTLN>(" </tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1 bgcolor=#fff> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā
<PRINTLN>(" <td width=340><strong>State:</strong>"+state1+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td width=98><strong>Code:</strong></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=54> "+code1+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td width=380><strong>State:</strong>"+state1+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td width=76><strong>Code:</strong></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=39> "+code1+"</td> ");
Ā
<PRINTLN>(" </tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1 bgcolor=#fff> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā
<PRINTLN>(" <td width=24 height=68><span <CLASS>=style8>S.NO</span></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=130> <div align=center <CLASS>=style7>Product Description </div></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=41><p <CLASS>=style6>HSNCode</p>Ā Ā </td> ");
Ā Ā Ā
<PRINTLN>(" <td width=49><div align=center <CLASS>=style6>Qty</div></td> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=73><div align=center <CLASS>=style6>Rate</div></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=97><div align=center <CLASS>=style6>Amt</div></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=54><div align=center><span <CLASS>=style1><strong>Discount</strong></span></div></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=75><span <CLASS>=style6>TaxableValue</span></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=134><table id=t01 width=210 border=1> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td width=200><div align=center <CLASS>=style4>CGST</div></td> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" </tr> ");
Ā Ā Ā Ā Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>("<td><table id=t01 width=200 border=1 bgcolor=#fff> ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td><div align=center <CLASS>=style7>Rate</div></td> ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td><span <CLASS>=style7>Amt</span></td> ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" </tr> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" </table></td> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" </tr> ");
Ā Ā Ā
<PRINTLN>(" </table></td> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=160><table id=t01 width=200 border=1> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td><div align=center <CLASS>=style4>SGST</div></td> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" </tr> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>("<td><table id=t01 width=200 border=1 bgcolor=#fff> ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td><div align=center <CLASS>=style6>Rate</div></td> ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td><span <CLASS>=style6>Amt</span></td> ");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>("</tr> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" </table></td> ");
Ā Ā Ā Ā Ā Ā
<PRINTLN>("</tr> ");
Ā Ā Ā
<PRINTLN>(" </table></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=110><div align=center <CLASS>=style4>TOTAL</div></td> ");
Ā
<PRINTLN>(" </tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1 bgcolor=#fff> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā
Ā Ā Ā
<PRINTLN>("<td align=right width=24><p> "+sno+"</p> ");
Ā Ā Ā Ā
Ā Ā Ā Ā
<PRINTLN>("<td align=right width=93> "+productdescription+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td align=right width=54 > "+hsncode+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td align=right width=38 > "+qty+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td align=right width=50 > "+rate+"</td> ");
//Write the business logic forĀ InvoiceBill
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā doubleĀ amount =(Convert.ToDouble(qty)) * (Convert.ToDouble(rate));
double amount1= ((Convert.ToDouble(rate1)/100) * Convert.ToDouble(amount));
double amount2= ((Convert.ToDouble(rate2)/100) * Convert.ToDouble(amount));
Ā Ā Ā
<PRINTLN>(" <td align=right width=65 > "+amount+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td align=right width=49 > "+discount+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td align=right width=74 > "+amount+"</td> ");
Ā Ā Ā Ā
<PRINTLN>("<td align=right width=85> "+rate1+"</td> ");
Ā Ā Ā Ā
<PRINTLN>("<td align=right width=99> "+amount1+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td align=right width=85 > "+rate2+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td align=right width=85> "+amount2+"</td> ");
//Business logic
double totalamount= amount+amount1+amount2;
<PRINTLN>(" <td align=right width=85> "+totalamount+"</td> ");
Ā
<PRINTLN>(" </tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 height=65 border=1 bgcolor=#fff> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā
<PRINTLN>("<td width=134><div align=center <CLASS>=style9><strong>TOTAL</strong></div></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=47> </td> ");
Ā Ā Ā
<PRINTLN>(" <td width=37>"+qty+"</td> ");
Ā Ā Ā
<PRINTLN>(" <td width=51> </td> ");
Ā Ā Ā
<PRINTLN>(" <td width=74><div align=center>"+amount+"</div></td> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=65><div align=right>"+discount+"</div></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=43><div align=right>"+amount+"</div></td> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=103> </td> ");
Ā Ā Ā Ā
<PRINTLN>("<td width=101><div align=right>"+amount1+"</div></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=205><div align=right>"+amount2+"</div></td> ");
Ā Ā Ā
<PRINTLN>(" <td width=95><div align=right>"+totalamount+"</div></td> ");
Ā
<PRINTLN>(" </tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1 bgcolor=#fff> ");
Ā Ā
<PRINTLN>("<tr> ");
Ā
Ā Ā Ā
<PRINTLN>(" <td width=487><div align=center><strong>Total Invoice amount in words </strong></div></td> ");
Ā
<PRINTLN>("<td width=88Ā <CLASS>=style15><span <CLASS>=style21>Total Amount Before Tax: </span></td> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td <CLASS>=style15> "+amount+"</td> ");
Ā Ā
<PRINTLN>("</tr> ");
Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā // note Amountinwords default is NIL
<PRINTLN>("<td><div align=center><inputĀ type=text name=Amountinwords value =NIL > </div></td> ");
Ā Ā Ā Ā
<PRINTLN>("<td><table id=t01 width=544 border=1 bgcolor=#fff> ");
Ā Ā Ā Ā Ā Ā
<PRINTLN>("<tr> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td width=420 <CLASS>=style15><strong>Add: CGST </strong></td> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td width=88 <CLASS>=style15> "+amount1+"</td> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" </tr> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>("<td <CLASS>=style15><strong>Add:SGST</strong></td> ");
Ā Ā Ā Ā Ā Ā
<PRINTLN>("Ā <td <CLASS>=style15> "+amount2+"</td> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" </tr> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td <CLASS>=style15><strong>Total Tax Amount: </strong></td> ");
Ā Ā Ā Ā Ā Ā
<PRINTLN>("Ā <td <CLASS>=style15> "+(amount1+amount2)+"</td> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" </tr> ");
Ā Ā Ā Ā Ā
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td <CLASS>=style15><strong>Total Amount After Tax: </strong></td> ");
Ā Ā Ā Ā Ā Ā
<PRINTLN>("Ā <td <CLASS>=style15> "+totalamount+"</td> ");
Ā Ā Ā Ā
<PRINTLN>("Ā </tr> ");
<PRINTLN>(" <tr> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td width=196><strong>GST on Reverse Charge </strong></td> ");
Ā Ā Ā Ā Ā Ā Ā
<PRINTLN>(" <td width=254> "+reversecharge+"</td>");
Ā Ā Ā Ā Ā
<PRINTLN>(" </tr> ");
Ā Ā Ā
<PRINTLN>(" </table></td> ");
Ā
<PRINTLN>(" </tr> ");
<PRINTLN>("</table> ");
<PRINTLN>("<table id=t01 width=1027 border=1 bgcolor=#fff> ");
<PRINTLN>("<table width=1027 border=1 bgcolor=#fff>");
Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā <PRINTLN>("<td width=294 height=203><table width=296 height=216 border=1 bgcolor=#fff>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(" <td width=238><div align=center><strong>Bank DetailsĀ </strong></div></td>");
Ā Ā Ā Ā Ā <PRINTLN>(" </tr>");
Ā Ā Ā Ā Ā <PRINTLN>(" <tr>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(" <td><strong>Name:</strong>"+bname+"</td>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td><strong>Bank A/C: </strong>"+bankaccount+"</td>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(" <td><strong>Bank IFSC: </strong>"+bankifsc+"</td>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(" <td height=61> </td>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā <PRINTLN>("</table></td>");
Ā Ā Ā Ā <PRINTLN>("<td width=163><table width=200 height=231 border=1 bgcolor=#fff>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(" <td height=121> </td>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td height=102><div align=center class=style22>Common Seal </div></td>");
Ā Ā Ā Ā Ā <PRINTLN>(" </tr>");
Ā Ā Ā Ā <PRINTLN>("</table></td>");
Ā Ā Ā Ā <PRINTLN>("<td width=551><table width=514 height=224 border=1 bgcolor=#fff>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(" <td><div align=center><em>Certified that the particulars given above are true and correct </em></div></td>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td><div align=center><strong>For XXXXX (p) Ltd </strong></div>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<p> </p>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<p align=center class=style13>Authorised signatory </p></td>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā <PRINTLN>("</table></td>");
Ā Ā <PRINTLN>("</tr>");
<PRINTLN>("</table>");
<PRINTLN>("<p> </p>");
<PRINTLN>("<p> </p>");
<PRINTLN>("<p> </p>");
<PRINTLN>("<p> </p>");
<PRINTLN>("<p> </p>");
<PRINTLN>("<p> </p>");
<PRINTLN>("</body>");
<PRINTLN>("</html>");
// path of wnosql db
String fpath=FileSequentialAccess.Read("filepath.txt");
//Mention the path where Invoice bill details are stored ....
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", fpath);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
//Give Proper credentials like username ,password ,table...
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String Ā t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
//Divide the InvoiceBill table in to 2 tables ie) Invoicebill and other one isĀ Invoicebill2
//Mentions the fields like CADDRESS ,etc to be created
String q = "CREATETABLE from Invoicebill 0 to 0 , 1 to 5 ?= 6639 By 6639 f(x) : {CADDRESS,INO,IDATE,Charge,State,code1,Name,Address,GSTIN,State,code2,sno,productdesc,hsncode,qty}: {} :{2,4}";
//Mentions the fields like rate ,etc to be created
String q1 ="CREATETABLE from Invoicebill2 0 to 0 , 1 to 5 ?= 6639 By 6639 f(x) : {rate,Amt,discount,Rate1,Amt1,Rate2,Amt2,total,ReverseCharge,Bankname,BankAccount,BankIFSC}: {} :{2,4}";
//Excecute the InvoiceTable querys
Ā Ā wdbaconn.WDBAQUERY(q);
Ā Ā wdbaconn.WDBAQUERY(q1);
CharĀ c= ' ';
// Calculate the size ofĀ the InvoiceBill tables using Wnosql PLSQL methods
OJ7Lib.J7ArrayList datas1= new OJ7Lib.J7ArrayList();
OJ7Lib.J7ArrayList datas11= new OJ7Lib.J7ArrayList();
for(int i=0;i<15;i++)
datas1.add(Ā WDBASQL.Query("TABLESIZE()","Invoicebill","0",null,27,"","", null,"",0,"","",c,null,t,1,5).get(i).ToString());
for(int i=0;i<12;i++)
datas11.add( WDBASQL.Query("TABLESIZE()","Invoicebill2","0",null,27,"","", null,"",0,"","",c,null,t,1,5).get(i).ToString());
// Make all data asĀ string
String t1="";String t2="";
t1=CADDRESS+","+invoiceno+","+invoicedate+","+reversecharge+","+state+","+code+","+name+","+BADDRESS+","+gstin+","+state1+","+code1+","+sno+","+productdescription+","+hsncode+","+qty;
t2=rate+","+amount+","+discount+","+rate1+","+amount1+","+rate2+","+amount2+","+totalamount+","+reversecharge+","+bname+","+bankaccount+","+bankifsc;
// Insert all the t1 data into Invoicebill table
StringĀ s12 ="INSERTINTO from Invoicebill 0 to "+datas1.size()+" , 1 to 5 ?= A By 1 1 : {0} : {"+t1+"} : {0}";
//Excecute the InvoiceTable insert query
Ā Ā wdbaconn.WDBAQUERY(s12);
// Insert all the t1 data into Invoicebill table
Ā Ā Ā Ā Ā Ā Ā Ā StringĀ s121 ="INSERTINTO from Invoicebill2 0 to "+datas11.size()+" , 1 to 5 ?= A By 1 1 : {0} : {"+t2+"} : {0}";
//Excecute the InvoiceTable insert querys
Ā Ā wdbaconn.WDBAQUERY(s121);
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
}
# š Explanation of ProgramĀ Ā
## š¹ Step 1: Display FormĀ Ā
Loads the **InvoiceBill.html** form for user input.Ā Ā
## š¹ Step 2: Collect FieldsĀ Ā
Defines 23 fields required for invoice processing (customer, product, tax, bank details).Ā Ā
## š¹ Step 3: Query Submitted DataĀ Ā
Retrieves submitted values using `Dotweb5.Lib.AddDotWebJ7Request`.Ā Ā
## š¹ Step 4: Business LogicĀ Ā
- Calculates **amount** = `qty Ć rate`.Ā Ā
- Calculates **CGST** and **SGST**.Ā Ā
- Computes **total amount after tax**.Ā Ā
## š¹ Step 5: Render InvoiceĀ Ā
Generates HTML tables dynamically using `<PRINTLN>` to display invoice details.Ā Ā
## š¹ Step 6: Database IntegrationĀ Ā
- Connects to **WNoSQL database**.Ā Ā
- Splits data into two tables:Ā Ā
Ā Ā - **Invoicebill** ā Customer and product details.Ā Ā
Ā Ā - **Invoicebill2** ā Rate, discount, tax, and bank details.Ā Ā
- Inserts data into tables.Ā Ā
ā ThisĀ **InvoiceBill.web** clearly separates each stage of the backend workflow: **form display, data collection,
Ā business logic, HTML rendering, database integration, and redirection**. It complements the AngularJS frontend to
Ā deliver a complete SPA-based invoice management system.
### š¹ Key StepsĀ Ā
1. **Display Form**Ā Ā
```Dotweb5.0
HTML.displayhtml("Invoicebill.html");
```
2. **Collect Fields**Ā Ā
- 23 fields are collected using `Dotweb5.Lib.AddDotWebJ7Request`.Ā Ā
3. **Business Logic**Ā Ā
```Dotweb5.0
double amount = (Convert.ToDouble(qty)) * (Convert.ToDouble(rate));
double amount1 = ((Convert.ToDouble(rate1)/100) * Convert.ToDouble(amount));
double amount2 = ((Convert.ToDouble(rate2)/100) * Convert.ToDouble(amount));
double totalamount = amount + amount1 + amount2;
```
- Calculates base amount, CGST, SGST, and total.Ā Ā
4. **HTML Rendering**Ā Ā
- Uses `<PRINTLN>` to dynamically generate tables showing:Ā Ā
Ā Ā - Customer detailsĀ Ā
Ā Ā - Product detailsĀ Ā
Ā Ā - Tax detailsĀ Ā
Ā Ā - Bank detailsĀ Ā
Ā Ā - Certification and authorizationĀ Ā
5. **Database Integration**Ā Ā
- Reads database path from `filepath.txt`.Ā Ā
- Connects to WNoSQL using credentials.Ā Ā
- Splits data into two tables:Ā Ā
Ā Ā - **Invoicebill** ā Customer and product details.Ā Ā
Ā Ā - **Invoicebill2** ā Rate, discount, tax, and bank details.Ā Ā
- Inserts data into tables using `INSERTINTO` queries.Ā Ā
# š Combined WorkflowĀ Ā
1. **Frontend (AngularJS)**Ā Ā
Ā Ā Ā - Collects invoice details via form.Ā Ā
Ā Ā Ā - Submits data to backend.Ā Ā
2. **Backend (OakJava7 + WNoSQL)**Ā Ā
Ā Ā Ā - Processes data with business logic.Ā Ā
Ā Ā Ā - Calculates amounts, discounts, CGST, SGST, and total.Ā Ā
Ā Ā Ā - Stores structured data in WNoSQL tables.Ā Ā
Ā Ā Ā - Dynamically generates formatted HTML invoice.Ā Ā
3. **Output**Ā Ā
Ā Ā Ā - Displays invoice bill with customer, product, tax, and bank details.Ā Ā
Ā Ā Ā - Provides certification and authorization section.Ā Ā
Ā Ā Ā - Redirects to same page for seamless SPA experience.Ā Ā
---
# ā SummaryĀ Ā
The **InvoiceBill SPA Project** demonstrates how a modern web application can integrate:Ā Ā
- **AngularJS frontend** for dynamic form handling.Ā Ā
- **OakJava7 backend** for business logic and HTML rendering.Ā Ā
- **WNoSQL database** for structured storage.Ā Ā
Together, they create a **complete invoice management system** that is fast, interactive, and user-friendly,
Ā embodying the principles of a Single Page Application.Ā
Ā š OUTPUT : Invoice Bill FormsĀ and Ā Invoice BillĀ forĀ theĀ Customer atĀ Washington , USA
==============================================================================================================
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ## š DOTWEB5.0 WebApplication AdvancedĀ Concepts : Type - 3
====================================================
## š What is an OakJava7 /Dotweb5.0 Servlet?Ā Ā
An OakJava7/Dotweb5.0 Servlet is essentially a way of writing HTML code using the `<PRINTLN>` statement or by invoking HTML through the `HTML.displayhtml` method.
---
## š What is the Include Directive in OakJava7?Ā Ā
The Include directive is used to insert components such as forms, reports, login pages, or other elements into the same page. The package used for including pages is **ScrollLib**.
---
## š QuestionĀ Ā
**Write an OakJava7/Dotweb5.0 Servlet to invoke the Register and Login pages, and include a Piechart in the same page.**
This functionality is not available in most programming languages. However, it can be achieved using OakJava7/Dotweb5.0.Ā Ā
In this example, the input should contain two GUI components (a Register page and a Login page) along with a Piechart. When data is entered in the Register page and credentials are entered in the Login page, pressing the Submit button should display the Register page data and print the executable file name `J7value`, which contains the data.
---
### Example Code (OakJava7 /Dotweb5.0 Servlet)
## š» File: MultForm.web
```java
<WEB>
// Calling ScrollLib library which contains the include directive for OakJava7 Servlet
<USE> ScrollLib;
<PACK> Oakjava7array {
Ā Ā Ā Ā <CLASS> Program {
Ā Ā Ā Ā Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Include Piechart7 chart
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Java7request.include("Piechart7", 1, "exe");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Registration page
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("MultiRegister.html");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Login page
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("web5login.html");
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā }
}
```
---
## š» File: MultiRegister.html (Registration Page)
```html
<!DOCTYPE html>
<html lang="en">
<body>
Ā Ā <header>
Ā Ā Ā Ā <h1>Register for Dotweb5.0</h1>
Ā Ā </header>
Ā Ā <div class="form-box">
Ā Ā Ā Ā <h2>Create Your Account</h2>
Ā Ā Ā Ā <form class="modal-content" action="http://localhost:9000/MyDetail.soweb" method="post">
Ā Ā Ā Ā Ā Ā <div class="form-group">
Ā Ā Ā Ā Ā Ā Ā Ā <label for="name1">Full Name</label>
Ā Ā Ā Ā Ā Ā Ā Ā <input type="text" id="name1" name="name1" required>
Ā Ā Ā Ā Ā Ā </div>
Ā Ā Ā Ā Ā Ā <div class="form-group">
Ā Ā Ā Ā Ā Ā Ā Ā <label for="uname1">Username</label>
Ā Ā Ā Ā Ā Ā Ā Ā <input type="text" id="uname1" name="uname1" required>
Ā Ā Ā Ā Ā Ā </div>
Ā Ā Ā Ā Ā Ā <div class="form-group">
Ā Ā Ā Ā Ā Ā Ā Ā <label for="password1">Password</label>
Ā Ā Ā Ā Ā Ā Ā Ā <input type="password" id="password1" name="password1" required>
Ā Ā Ā Ā Ā Ā </div>
Ā Ā Ā Ā Ā Ā <div class="form-group">
Ā Ā Ā Ā Ā Ā Ā Ā <label for="state1">State</label>
Ā Ā Ā Ā Ā Ā Ā Ā <input type="text" id="state1" name="state1">
Ā Ā Ā Ā Ā Ā </div>
Ā Ā Ā Ā Ā Ā <div class="form-group">
Ā Ā Ā Ā Ā Ā Ā Ā <label for="country1">Country</label>
Ā Ā Ā Ā Ā Ā Ā Ā <input type="text" id="country1" name="country1">
Ā Ā Ā Ā Ā Ā </div>
Ā Ā Ā Ā </form>
Ā Ā </div>
</body>
</html>
```
---
## š» File: web5login.html (Login Page)
```html
<!DOCTYPE html>
<html>
<head>
Ā Ā <title>User Login</title>
Ā Ā </head>
<body onLoad="disableClick()" oncontextmenu="return false" background="https://picsum.photos/200/300/?random" bgcolor="gold">
<button onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Sign Up</button>
<div id="id01" class="modal">
Ā Ā <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
Ā Ā <div class="container">
Ā Ā Ā Ā <h2><a href="#chapter1">Enter your Details</a></h2>
Ā Ā Ā Ā <p><label> User Name: <input type="text" name="uname" size="25" /></label></p>
Ā Ā Ā Ā <p><label> Password: <input type="password" name="password" size="15" /></label></p>
Ā Ā Ā Ā <div class="clearfix">
Ā Ā Ā Ā Ā Ā <input type="submit" name="Click">
Ā Ā Ā Ā Ā Ā <input type="reset" name="Clear">
Ā Ā Ā Ā </div>
Ā Ā Ā Ā <div class="container" style="background-color:#f1f1f1">
Ā Ā Ā Ā Ā Ā <p align="center">Jemin Information Technology 2024 (C) All Rights Reserved</p>
Ā Ā Ā Ā </div>
Ā Ā </div>
</div>
<script>
var modal = document.getElementById('id01');
window.onclick = function(event) {
Ā Ā if (event.target == modal) {
Ā Ā Ā Ā modal.style.display = "none";
Ā Ā }
}
</script>
</body>
</html>
```
---
---
## š OakJava7/Dotweb5.0 Servlet with ScrollLib and J7Value12.exe
This example demonstrates how OakJava7/Dotweb5.0 can process form data, display it in a table, and include an executable (`J7Value12.exe`) to retrieve and display data from a WNoSQL database.Ā Ā
---
## š Explanation
1. **Libraries Used**Ā Ā
Ā Ā Ā - `ScrollLib`: Provides the include directive.Ā Ā
Ā Ā Ā - `Security`, `OJ7UTIL`, `j7security`: Utility and security packages for handling form data and queries.Ā Ā
2. **Process Flow**Ā Ā
Ā Ā Ā - Collect form parameters into an `ArrayList`.Ā Ā
Ā Ā Ā - Use `Dotweb5.Lib.AddDotWebJ7Request` to map form data to database parameters.Ā Ā
Ā Ā Ā - Display the results in an HTML table using `<PRINTLN>`.Ā Ā
Ā Ā Ā - In the `finally` block, include the executable `J7Value12.exe` to display additional data.Ā Ā
---
## š» File: MyDetail.web
```Dotweb5
<WEB>Ā
<USE> ScrollLib;
<PACK> SDpack {
Ā Ā Ā Ā <CLASS> statics {
Ā Ā Ā Ā Ā Ā Ā Ā public static void display() {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <TRY> {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Collect form parameters
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā string fields = "name1,uname1,password1,state1,country1,uname,password,NOT";
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Start HTML output
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<!DOCTYPE html>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<body bgcolor='pink'>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<form>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Query form dataĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā OJ7Lib.J7ArrayList armg= Dotweb5.Lib.AddDotWebJ7Request("MyDetailj7.dsn" ,Dotweb5.Lib.AddArrayListData(fields),7,1 );
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Display results in a table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<table bgcolor='gold'>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Name</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Username</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Password</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>State</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Country</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Username</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>Password</th>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Loop through form data
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i = 0; i < armg.size()-1; i += 6) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + armg.get(i).ToString() + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + armg.get(i+1).ToString() + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + armg.get(i+2).ToString() + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + armg.get(i+3).ToString() + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + armg.get(i+4).ToString() + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + armg.get(i+5).ToString() + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>" + armg.get(i+6).ToString() + "</td>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</table>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</form>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</html>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</body>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <CATCH> (Exception e) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Handle exceptions
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <Finally> {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The Finally block is executed...");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Include executable to display data
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Java7request.include("J7Value12", 1, "exe");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā display();
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā }
}
```
---
# ā Key Points
- **Form Handling:** Parameters are collected into an `ArrayList` and mapped using `Dotweb5.Lib.AddDotWebJ7Request`.Ā Ā
- **Dynamic Output:** Data is printed into an HTML table using `<PRINTLN>`.Ā Ā
- **Executable Inclusion:** `Java7request.include("J7Value12", 1, "exe")` integrates external processing logic.Ā Ā
Ā š OUTPUTĀ : Piechart ,Register pageĀ , Login Page
NextĀ PageĀ forĀ MULTIFORM (The Combination ofĀ register page and Login page OutputsĀ in Table Format) andĀ Retrieval ofĀ Eno, Name ,Designation ,Salary from Wnosqldb withĀ SoWeb Theme.
==============================================================================================================
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ## šĀ Ā Ā Dotweb5.0Ā WithĀ CANVASĀ Animation WithĀ JQuery
===============================================================================================================
Ā ## š Ā Question :DrawĀ aĀ HouseĀ with Moving MoonĀ AnimationĀ withĀ HTML Canvas + JqueryĀ + Dotweb5.0 :
Ā ## š» File: housemoon.html
<!DOCTYPE html>
<html>
<head>
Ā Ā <title>House with Moving Moon</title>
Ā Ā <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
Ā Ā <style>
Ā Ā Ā Ā body { margin:0; background:#000; }
Ā Ā Ā Ā canvas { display:block; margin:auto; background:#001d3d; }
Ā Ā </style>
</head>
<body>
Ā Ā <canvas id="nightScene" width="800" height="500"></canvas>
Ā Ā <script>
Ā Ā Ā Ā $(document).ready(function() {
Ā Ā Ā Ā Ā Ā const canvas = document.getElementById("nightScene");
Ā Ā Ā Ā Ā Ā const ctx = canvas.getContext("2d");
Ā Ā Ā Ā Ā Ā let moonX = 50;Ā Ā Ā
Ā Ā Ā Ā Ā Ā let moonY = 100;
Ā Ā Ā Ā Ā Ā function drawHouse() {
Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillStyle = "#654321";
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillRect(300, 300, 200, 150);
Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillStyle = "#8B0000";
Ā Ā Ā Ā Ā Ā Ā Ā ctx.beginPath();
Ā Ā Ā Ā Ā Ā Ā Ā ctx.moveTo(300, 300);
Ā Ā Ā Ā Ā Ā Ā Ā ctx.lineTo(400, 200);
Ā Ā Ā Ā Ā Ā Ā Ā ctx.lineTo(500, 300);
Ā Ā Ā Ā Ā Ā Ā Ā ctx.closePath();
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fill();
Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillStyle = "#222";
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillRect(380, 370, 40, 80);
Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillStyle = "#87CEEB";
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillRect(320, 330, 40, 40);
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillRect(440, 330, 40, 40);
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā function drawMoon(x, y) {
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillStyle = "#fdfd96";
Ā Ā Ā Ā Ā Ā Ā Ā ctx.beginPath();
Ā Ā Ā Ā Ā Ā Ā Ā ctx.arc(x, y, 40, 0, Math.PI * 2);
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fill();
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā function animate() {
Ā Ā Ā Ā Ā Ā Ā Ā ctx.clearRect(0, 0, canvas.width, canvas.height);
Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillStyle = "white";
Ā Ā Ā Ā Ā Ā Ā Ā for (let i = 0; i < 50; i++) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ctx.fillRect(Math.random() * canvas.width, Math.random() * canvas.height, 2, 2);
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā drawHouse();
Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā drawMoon(moonX, moonY);
Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā moonX += 1;
Ā Ā Ā Ā Ā Ā Ā Ā if (moonX > canvas.width + 40) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā moonX = -40;Ā
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā requestAnimationFrame(animate);
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā animate();
Ā Ā Ā Ā });
Ā Ā </script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
Ā Ā <title>House with Moving Moon</title>
Ā Ā <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
Ā Ā <style>
Ā Ā Ā Ā body { margin:0; background:#000; }
Ā Ā Ā Ā canvas { display:block; margin:auto; background:#001d3d; }
Ā Ā </style>
</head>
<body>
Ā Ā <canvas id="nightScene" width="800" height="500"></canvas>
</body>
</html>
Declares HTML5 document type.
Loads jQuery for DOM readiness handling.
Defines a canvas element where all graphics are drawn.
Background colors simulate a night sky.
$(document).ready(function() {
Ā Ā const canvas = document.getElementById("nightScene");
Ā Ā const ctx = canvas.getContext("2d");
Ā Ā let moonX = 50;Ā Ā Ā
Ā Ā let moonY = 100;
Ensures script runs only after DOM is fully loaded.
Retrieves canvas and sets up 2D drawing context.
Initializes moon position variables.
function drawHouse() {
Ā Ā // Base
Ā Ā ctx.fillStyle = "#654321";
Ā Ā ctx.fillRect(300, 300, 200, 150);
Ā Ā // Roof
Ā Ā ctx.fillStyle = "#8B0000";
Ā Ā ctx.beginPath();
Ā Ā ctx.moveTo(300, 300);
Ā Ā ctx.lineTo(400, 200);
Ā Ā ctx.lineTo(500, 300);
Ā Ā ctx.closePath();
Ā Ā ctx.fill();
Ā Ā // Door
Ā Ā ctx.fillStyle = "#222";
Ā Ā ctx.fillRect(380, 370, 40, 80);
Ā Ā // Windows
Ā Ā ctx.fillStyle = "#87CEEB";
Ā Ā ctx.fillRect(320, 330, 40, 40);
Ā Ā ctx.fillRect(440, 330, 40, 40);
}
Rectangles form the house body, door, and windows.
Path drawing creates a triangular roof.
Colors simulate wood, brick, and glass.
function drawMoon(x, y) {
Ā Ā ctx.fillStyle = "#fdfd96";
Ā Ā ctx.beginPath();
Ā Ā ctx.arc(x, y, 40, 0, Math.PI * 2);
Ā Ā ctx.fill();
}
Uses arc() to draw a circular moon.
Soft yellow color gives a glowing effect.
function animate() {
Ā Ā ctx.clearRect(0, 0, canvas.width, canvas.height);
Ā Ā // Stars
Ā Ā ctx.fillStyle = "white";
Ā Ā for (let i = 0; i < 50; i++) {
Ā Ā Ā Ā ctx.fillRect(Math.random() * canvas.width, Math.random() * canvas.height, 2, 2);
Ā Ā }
Ā Ā // House + Moon
Ā Ā drawHouse();
Ā Ā drawMoon(moonX, moonY);
Ā Ā // Move moon
Ā Ā moonX += 1;
Ā Ā if (moonX > canvas.width + 40) {
Ā Ā Ā Ā moonX = -40;Ā
Ā Ā }
Ā Ā requestAnimationFrame(animate);
}
animate();
Clears canvas each frame.
Random stars simulate twinkling.
Draws house and moon.
Updates moonās x position for smooth movement.
Uses requestAnimationFrame() for efficient animation.
In Dotweb5.0 documentation style, this example demonstrates:
Scenario-driven clarity: Each function has a clear role (house, moon, animation).
Decorated headings: Sections are visually distinct for HR/technical review.
Iterative workflow: Moonās movement is updated frame by frame, showing modular design.
User empowerment: Easy to extend (add trees, gradient sky, glowing windows).
ā
Summary:
This program builds a night scene with a house and a moving moon using Canvas graphics controlled by jQuery. The animation loop ensures continuous motion, while modular functions keep the design maintainableāexactly the kind of robust, scenario-driven workflow Dotweb5.0 emphasizes.
Got it ā letās break down your Dotweb5.0 program step by step, in the same decorated, scenario-driven style we used earlier.
Ā ## š» File: housemoonanimation.web
<WEB>Ā
Ā Ā <PACK>Ā animation
{Ā Ā Ā Ā Ā Ā Ā Ā Ā
<CLASS>Ā moonhouse
{Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā public static void display()
Ā Ā Ā Ā Ā Ā Ā Ā {
HTML.displayhtml("housemoon.html");
Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā public void main() Ā Ā {Ā Ā
display();Ā Ā Ā
Ā }Ā Ā Ā
}
Ā Ā }Ā
<WEB>Ā Ā
Ā Ā <PACK>Ā animation
{Ā Ā Ā Ā Ā Ā Ā Ā Ā
<CLASS>Ā moonhouse
{Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā public static void display()
Ā Ā Ā Ā Ā Ā Ā Ā {Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("housemoon.html");Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā public void main()Ā Ā Ā
Ā Ā Ā {Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā display();Ā Ā Ā Ā
Ā Ā Ā }Ā Ā
}Ā Ā
}
<WEB> ā Declares this as a Dotweb5.0 web program.
<PACK> animation ā Defines a package named animation.
<CLASS> moonhouse ā Creates a class called moonhouse.
public static void display()
{
Ā Ā Ā HTML.displayhtml("housemoon.html");
}
A static method that calls HTML.displayhtml().
This function loads and displays the HTML file housemoon.html (the one you wrote earlier with Canvas + jQuery).
In Dotweb5.0, HTML.displayhtml() is the bridge between backend logic and frontend rendering.
public void main()Ā Ā Ā
{Ā Ā
Ā Ā Ā display();Ā Ā Ā Ā
}Ā Ā
The entry point of the program.
Calls display() so that when the program runs, it immediately shows the house with moving moon animation.
Program starts ā main() is invoked.
main() calls display().
display() loads housemoon.html.
The HTML file runs its Canvas + jQuery animation, showing the house and moon.
Separation of Concerns:
Dotweb5.0 class (moonhouse) handles program logic.
HTML file (housemoon.html) handles graphics and animation.
Scenario-driven clarity:
The Dotweb5.0 program acts as a launcher for the HTML animation.
Maintainability:
If you change the animation file, you donāt need to rewrite the Dotweb5.0 class ā just point to the new HTML.
ā
Summary:
The Dotweb5.0 program moonhouse is essentially a wrapper that loads and displays the HTML animation file. The HTML file contains the Canvas + jQuery logic for drawing the house and animating the moon. Together, they demonstrate Dotweb5.0ās modular design: backend class triggers ā frontend HTML renders ā user sees the animated scene.
==============================================================================================================
Ā š OUTPUT : HouseĀ withĀ Animated Moon
=============================================================================================================
=============================================================================================================
Ā ## š» File: shortestpath.web
<WEB>Ā
Ā // load fx libraries
Ā <USE> fx;
// load format libraries
Ā Ā <USE>Ā format;Ā
// load java7displayurl libraries.
Ā <USE>Ā java7displayurl;Ā
Ā Ā Ā <PACK>Ā fusions {Ā Ā Ā Ā Ā
Ā Ā Ā Ā <CLASS>Ā chartss {Ā Ā Ā Ā Ā
Ā Ā Ā Ā public static void display() {Ā StringĀ s="";Ā Ā
// get the contents of the ShortestPath.WS script fileĀ containing Java Script or Jquery logics.
Ā s=java7UrlConnectionReader.getUrlContents("http://localhost:8082/ShortestPath.WS").Replace("<HTML>","").Replace("</html>","");Ā Ā
string filePath = "sdata.html";
Ā J7HTML.displayhtml("shortestpath1.html");
Ā Ā Ā Ā Ā Ā Ā Ā // Write the content to the file
Ā Ā Ā Ā Ā Ā Ā Ā FileSequentialAccess.Write(filePath, s);
<PRINTLN>("<script>");
Ā // Use J7Html to print blank lines between the lines.
Ā J7HTML.displayhtml(filePath);Ā
<PRINTLN>("</script>");
Ā J7HTML.displayhtml("shortestpath2.html");Ā Ā Ā Ā
Ā }Ā Ā Ā
Ā
Ā Ā Ā Ā Ā
Ā
Ā public void main()Ā Ā
Ā Ā Ā { display(); Ā Ā } Ā }Ā Ā
Ā }Ā
Your ShortestPath.web script is structured to integrate Dotweb5.0, Web1.0 webservices, and HTML rendering using the Soweb theme. Letās break it down step by step:
Library Imports
<USE> fx;
<USE> format;
<USE> java7displayurl;
fx ā loads functional libraries.
format ā handles formatting utilities.
java7displayurl ā provides URL connection and content reading utilities.
Package and Class Definition
<PACK> fusions {
Ā Ā <CLASS> chartss {
Defines a package fusions and a class chartss where the main logic resides.
Display Method
public static void display() {
Ā Ā Ā Ā String s="";
Ā Ā Ā Ā s = java7UrlConnectionReader.getUrlContents("http://localhost:8082/ShortestPath.WS")
Ā Ā Ā Ā Ā Ā Ā Ā .Replace("<HTML>","")
Ā Ā Ā Ā Ā Ā Ā Ā .Replace("</html>","");
Reads the contents of the ShortestPath.WS script file (which contains JavaScript/jQuery logic for shortest path visualization).
Cleans up unwanted HTML tags.
File Handling
string filePath = "sdata.html";
FileSequentialAccess.Write(filePath, s);
Stores the processed script into a local file (sdata.html).
HTML Display
J7HTML.displayhtml("shortestpath1.html");
<PRINTLN>("<script>");
J7HTML.displayhtml(filePath);
<PRINTLN>("</script>");
J7HTML.displayhtml("shortestpath2.html");
Uses J7HTML.displayhtml to render HTML files sequentially:
shortestpath1.html ā header or setup.
sdata.html ā the dynamic shortest path logic.
shortestpath2.html ā footer or closing elements.
Wraps the script logic inside <script> tags for execution.
Main Method
public void main() { display(); }
Calls display() to execute the workflow.
Purpose: This program demonstrates how to integrate Dotweb5.0 with Web1.0 services and HTML rendering to visualize shortest path algorithms.
Flow:
Load libraries ā Fetch shortest path script ā Clean HTML ā Save to file ā Render with Soweb theme.
Outcome: The shortest path logic (from ShortestPath.WS) is dynamically embedded into an HTML page, decorated with Soweb theme styling, and displayed to the user.
## š» File: shortestpath1.html
<!DOCTYPE html>
<html>
<head>
Ā Ā <title>Shortest Path</title>
Ā Ā <style>
Ā Ā Ā Ā canvas { border: 1px solid black; }
Ā Ā Ā Ā #controls { margin-top: 10px; }
Ā Ā textarea { width: 400px; height: 80px; }
Ā Ā </style>
</head>
<body>
Ā Ā <h2>Shortest Path Visualizer</h2>
Ā Ā <canvas id="graphCanvas" width="600" height="400"></canvas>
Ā Ā
Ā Ā <div id="controls">
Ā Ā Ā Ā <label>Enter edges (ArrayList style, e.g. [[0,1,2],[2,3,4]]):</label><br>
Ā Ā Ā Ā <textarea id="edgesInput">[[0,1,2],[2,3,4]]</textarea><br><br>
Ā Ā Ā Ā <button onclick="drawGraph()">Draw Graph</button><br><br>
Ā Ā Ā Ā <button onclick="findShortestPath()">Find Path</button><br>
Ā Ā </div>
Ā Ā
Ā Ā <p id="result"></p>
## š» File: shortestpath2.html
</body>
</html>
<!DOCTYPE html>
<html>
<head>
Ā Ā <title>Shortest Path</title>
Ā Ā <style>
Ā Ā Ā Ā canvas { border: 1px solid black; }
Ā Ā Ā Ā #controls { margin-top: 10px; }
Ā Ā Ā Ā textarea { width: 400px; height: 80px; }
Ā Ā </style>
</head>
<!DOCTYPE html> ā Declares this is an HTML5 document.
<title> ā Sets the browser tab title to Shortest Path.
<style> ā Defines CSS styling:
canvas has a black border.
#controls has spacing above it.
textarea is styled to be wide (400px) and tall (80px).
<body>
Ā Ā <h2>Shortest Path Visualizer</h2>
Ā Ā <canvas id="graphCanvas" width="600" height="400"></canvas>
<h2> ā Displays the heading Shortest Path Visualizer.
<canvas> ā Creates a drawing area (600px wide, 400px tall) where the graph will be drawn using JavaScript.
Ā <div id="controls">
Ā Ā Ā Ā <label>Enter edges (ArrayList style, e.g. [[0,1,2],[2,3,4]]):</label><br>
Ā Ā Ā Ā <textarea id="edgesInput">[[0,1,2],[2,3,4]]</textarea><br><br>
Ā Ā Ā Ā <button onclick="drawGraph()">Draw Graph</button><br><br>
Ā Ā Ā Ā <button onclick="findShortestPath()">Find Path</button><br>
Ā Ā </div>
<div id="controls"> ā Container for user input and buttons.
<label> ā Instruction text telling the user how to enter edges.
<textarea id="edgesInput"> ā Input box where the user types graph edges in JSON-like format.
Example: [[0,1,2],[2,3,4]] means an edge from node 0 to node 1 with weight 2, and another from node 2 to node 3 with weight 4.
<button onclick="drawGraph()"> ā Button that calls the JavaScript function drawGraph() to render the graph.
<button onclick="findShortestPath()"> ā Button that calls findShortestPath() to compute and highlight the shortest path.
Ā <p id="result"></p>
</body>
</html>
<p id="result"> ā Empty paragraph where results (like shortest path details) will be displayed dynamically by JavaScript.
This HTML page sets up:
A canvas for drawing the graph.
A textarea for entering edge data.
Two buttons to trigger graph drawing and shortest path calculation.
A result area to show the computed path.
š OUTPUT : Shortest Path forĀ the given data (Graph theory)
===========================================================================================================
===========================================================================================================
ReferĀ Dotweb5.0 Advanced concepts - Type 3
To enforce HTTP Transport Security and related protections, the following directives are added to the j7Security file:
X-Content-Type-Options <- nosniff
Strict-Transport-Security <- max-age=31536000 ; includeSubDomains
X-Frame-Options <- SAMEORIGIN
X-XSS-Protection <- 1; mode=block
Content-Security-Policy <- default-src 'self' 'unsafe-inline' http://localhost:8082/
X-Content-Type-Options: nosniff
Prevents browsers from interpreting files as a different MIME type, reducing exposure to driveāby downloads and malicious scripts.
Strict-Transport-Security: max-age=31536000; includeSubDomains
Forces all communication to use HTTPS for one year (31,536,000 seconds), including all subdomains.
X-Frame-Options: SAMEORIGIN
Blocks the site from being embedded in iframes on other domains, preventing clickjacking attacks.
X-XSS-Protection: 1; mode=block
Enables browserābased crossāsite scripting filters and blocks detected attacks.
Content-Security-Policy: default-src 'self' 'unsafe-inline' http://localhost:8082/
Restricts resources to the same origin and explicitly allows inline scripts and resources from localhost:8082.
This configuration ensures that Dotweb5.0 applications automatically enforce strong transportālevel security and modern browser protections when rendering the next page or output page. By embedding these rules in j7cpolicy.txt, developers gain default safeguards against common web vulnerabilities while maintaining compatibility with local services (like ShortestPath.WS running on localhost:8082).
š OUTPUT : Ā Dotweb5.0Ā Default SecurityĀ Type -1
=========================================================================================================
=========================================================================================================
This program demonstrates how to use Dotweb5.0 with the J7WXML.wxmlr parser to convert a Wilmix Markup Language (WML) registration form into HTML format. The converted HTML is then displayed dynamically, allowing developers to design forms declaratively in WML while Dotweb5.0 handles the conversion and rendering.
<WEB>Ā Ā
Ā Ā Ā <PACK> WXMLS {Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā <CLASS> J7formss {Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā public static void display() {Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā // This parser converts Register.wml into HTML format using J7WXML.wxml<PARSE>r
Ā Ā Ā Ā Ā Ā Ā Ā Ā // The parameter '1' indicates it is for Form type.
Ā Ā Ā Ā Ā Ā Ā Ā Ā string v = J7WXML.wxml<PARSE>r("Register.wml", 1, "", "", null);
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Print the converted HTML
Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("" + v);Ā Ā
Ā Ā Ā Ā Ā Ā Ā }Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā public void main() {Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā display();Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā }Ā Ā Ā
Ā Ā Ā Ā Ā }Ā Ā Ā
Ā Ā Ā }Ā Ā
<WML>
Ā Ā <FORM TITLE='RegisterForm' Method='post'Ā
Ā Ā Ā Ā Ā Ā Ā Ā Url='http://localhost:9000/jwxmlform.soweb'
Ā Ā Ā Ā Ā Ā Ā Ā color='green' Tcolor='gold' Name='ADD Form'Ā
Ā Ā Ā Ā Ā Ā Ā Ā GUICount='4' Password='no' Space='yes'
Ā Ā Ā Ā Ā Ā Ā Ā Type='submit' fields='{name,city,add,idno}'
Ā Ā Ā Ā Ā Ā Ā Ā GUI='text' Names='' Input='{ROWS,COLS}'/>
</WML>
Wilmix Markup Language (WML):
A specialized markup language used in Dotweb5.0 for defining forms and GUI components.
Parser Usage:
The J7WXML.wxml<PARSE>r function reads the WML file (Register.wml) and converts it into HTML.
Form Type Parameter:
The 1 parameter specifies that the conversion is for a form type.
Output:
The converted HTML is stored in a string (v) and printed using <PRINTLN>.
WML Form Attributes:
TITLE='RegisterForm' ā Sets the form title.
Method='post' ā Defines the HTTP method for submission.
Url='http://localhost:9000/jwxmlform.soweb' ā Specifies the submission endpoint.
color='green', Tcolor='gold' ā Defines form and title colors.
GUICount='4' ā Number of GUI fields.
fields='{name,city,add,idno}' ā Input fields for registration.
GUI='text' ā Input type is text.
Input='{ROWS,COLS}' ā Layout specification.
This program shows how Dotweb5.0 Advanced Concepts (Typeā5) can be used to:
Parse Wilmix Markup Language (WML) forms into HTML using the J7WXML parser.
Automatically generate a registration page with styled fields.
Integrate with Web1.0 services (jwxmlform.soweb) for form submission.
By leveraging WML definitions, developers can design forms declaratively and let Dotweb5.0 handle the conversion and rendering, ensuring consistency, security, and efficiency across applications.
š OUTPUT :Ā Ā J7WXML Forms , Table OutputĀ UsingĀ J7WXML template andĀ soweb template
==============================================================================================================
---- TYPE-6
==================================================================================================
In Dotweb5.0, session context programming allows developers to manage data flow between pages, track sessions, and share context across applications. The key components are:
Forward ā Pass lists or values to another page.
Include ā Include external files or applications in a servlet.
Java7Session ā Create and manage session variables.
Java7Context ā Assign unique values (shared memory across servlets).
Java7Config ā Retrieve configuration parameters.
LArray ā LArray Collection is to Store Data and many List type dataĀ
<WEB>
<USE> ScrollLib;
<PACK> example11
{
public <CLASS> Program
Ā Ā {
public static forward flist= null;Ā Ā
public static Java7Session list1 = new Java7Session("No of employees","1000 employees");
public static Java7Context list = new Java7Context("Secretno=1089678");
public static void p()
{
list1.setValue("seqno1","2000 values");
list1.setValue("seqno2","2001 values");
list1.setValue("seqno3","2005 values");
OJ7Lib.J7ArrayList ar = new OJ7Lib.J7ArrayList();
OJ7Lib.J7ArrayList ar1 = new OJ7Lib.J7ArrayList();
for(int i=0;i<100;i++)
ar.add(i,i);
int count=0;
for(int i=100;i<200;i++)
{
ar1.add(count,i);
count++;
}
// LArray toĀ StoreĀ ArrayListĀ as a Data type format
// eg)Ā itĀ will storeĀ likeĀ [1,2,3,4],[567,8],879Ā
CLIB.LArray la= new CLIB.LArray("DatasIstSet");
CLIB.LArray la1= new CLIB.LArray("Data2ndSet");
for(int i=0;i<100;i=i+1)
la.add(i,ar.get(i));
for(int i=0;i<100;i=i+1)
la1.add(i,ar1.get(i));
// forward isĀ use to forward request data contains LArray la
Ā flist=new forward("language0",la);
flist.setValue("language1",la1);
}Ā
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā }
Forward:
Creates two ArrayLists (ar and ar1) with 200 values.
Forwards them using keys language0 and language1.
Java7Session:
Stores employee data and sequence values (seqno1, seqno2, seqno3).
Java7Context:
Assigns a unique value (Secretno=1089678) that can be shared across servlets.
Hereās a clear, scenarioādriven explanation of what your Dotweb5.0 program is doing:
This program demonstrates session tracking and data structuring using Dotweb5.0 with OakJava7 libraries. It simulates storing employee session values, secret configuration data, and organizes lists of integers into structured arrays.
Library Usage
<USE> ScrollLib; ā Imports the Scroll Framework library for structured web programming.
Packages like OJ7Lib and CLIB are used for advanced data structures.
Session Initialization
Java7Session list1 = new Java7Session("No of employees","1000 employees");
ā Creates a session object holding employee count information.
Java7Context list = new Java7Context("Secretno=1089678");
ā Stores a secret configuration number in the session context.
Session Values
list1.setValue("seqno1","2000 values");
list1.setValue("seqno2","2001 values");
list1.setValue("seqno3","2005 values");
ā These simulate storing multiple sequence values in the session.
ArrayList Creation
Two OJ7Lib.J7ArrayList objects (ar and ar1) are created.
ar stores integers from 0 to 99.
ar1 stores integers from 100 to 199, indexed by a separate counter.
LArray (List of Lists)
CLIB.LArray la and CLIB.LArray la1 are created to hold structured sets:
la stores values from ar (0ā99).
la1 stores values from ar1 (100ā199).
These arrays act like nested collections, useful for organizing multiple datasets.
Forward Reference
flist = new forward("language0", la);
ā Creates a forward object linking "language0" to the first dataset (la).
This is essentially a pointer or reference for later use in the program.
Session Tracking: Storing values (seqno1, seqno2, etc.) in a session object.
Context Management: Holding secret configuration (Secretno=1089678).
Data Structuring: Using J7ArrayList and LArray to organize integer sequences.
Forward Linking: Passing structured data forward for later processing.
š In short:
This Dotweb5.0 program tracks employee session data, stores secret configuration values, builds two sets of integer lists, organizes them into structured arrays, and forwards one dataset for further use.
Output:
This program compiles into sessiontracking.web.dll, which is placed in the oakjava7/src and oakjava7/src/lib directories.
<WEB>
<USE> ScrollLib;
<USE> example11;
<USE> format;
<PACK> Sessiontracks1
{
<CLASS> Program1
Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā public void main()
Ā Ā Ā Ā Ā Ā Ā Ā {
J7HTML.displayhtml("j7design.html");
Ā <TRY>
Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā <PRINTLN>("Ā <BR> Ā ");
Program.p();
Ā Ā Ā Ā Ā <PRINTLN>("Ā <BR> Ā ");
<OJ7UTIL>.ArrayList la= Program.flist.getForwardValue("language0");
<PRINTLN>(" <B>The value ofĀ seqno1 </B>");Ā
<PRINTLN>("<BR>");
Ā OJ7Lib.J7ArrayList ar= new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // getForward will return list format , so convert to String format by replacing "[" and "]" with spaces
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā String data=Program.flist.getForwardValue("language0").ToString().Replace("[","").Replace("]","");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā //thereĀ are 100 datas in the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i=0;i< 100;i++)
// Past the StringĀ data into <AUTOBOX_ARRAY> , which will convert data to Arraylist data by Ith elementĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ar.add( i,<AUTOBOX_ARRAY>(data).get(i).ToString());
// Print the data in A1 A2,A3,A4,A5 format using <J7PRINT>
Ā Ā Ā Ā Ā Ā Ā Ā Ā // There are 5 columns andĀ so the arraylist isĀ incremented by 5
Ā Ā Ā Ā Ā Ā Ā Ā Ā for (int i = 0; i < 100; i += 5) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i+1).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i+2).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i+3).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i+4).ToString());
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā }
<PRINTLN>(" Ā <BR> Ā Ā ");
Ā <PRINTLN>("<B> Session value ofĀ seqno1 </B> ="+Program.list1.getSessionValue("seqno1"));Ā
<PRINTLN>("Ā <BR> Ā ");
Ā <PRINTLN>(" <B> OakJava7Context </B> ="+Program.list.get(0).ToString());Ā
<PRINTLN>("Ā <BR> Ā ");
Ā Ā Ā Ā <PRINTLN>(" <B> Java7config </B>="+Java7Config.getParameter("Driver"));
<PRINTLN>(" <BR>Ā Ā ");
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā <CATCH> (Exception e)
Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Error.... "+e);
Ā Ā Ā Ā Ā Ā }Ā Ā
Ā Ā Ā Ā Ā <Finally>
Ā Ā Ā Ā Ā Ā {
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The Finally blockĀ isĀ executed...");
Ā Ā Ā Ā Ā Ā }Ā
Ā
Ā Ā Ā Ā }
Ā
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā }
Forward Retrieval:
Retrieves forwarded values using Program.flist.getForwardValue("language0").
Session Retrieval:
Accesses session values with Program.list1.getSessionValue("seqno1").
Context Retrieval:
Reads the unique context value (Secretno=1089678) using Program.list.get(0).ToString().
Config Retrieval:
Fetches configuration parameters (e.g., Driver) using Java7Config.getParameter("Driver").
Error Handling:
Uses <TRY>, <CATCH>, and <Finally> blocks to manage exceptions and ensure final execution.
This program demonstrates session tracking, data conversion, and formatted output in a web environment using Dotweb5.0 and OakJava7 libraries. It integrates HTML display, error handling, and structured printing of session data.
HTML Display
J7HTML.displayhtml("j7design.html");
Loads and displays an HTML design file (j7design.html) as part of the web output.
2. Calling Another Program
Program.p();
Executes the p() method from the earlier Program class (which sets up session values and arrays).
3. Forward Value Retrieval
<OJ7UTIL>.ArrayList la = Program.flist.getForwardValue("language0");
Retrieves the forwarded dataset (language0) created earlier and stores it in an ArrayList.
4. Data Conversion
String data = Program.flist.getForwardValue("language0")
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā .ToString().Replace("[","").Replace("]","");
Converts the list format into a string representation by removing brackets.
This prepares the data for further parsing.
5. Autobox Conversion
ar.add(i, <AUTOBOX_ARRAY>(data).get(i).ToString());
Uses <AUTOBOX_ARRAY> to convert the string back into an ArrayList, element by element.
This bridges between raw string data and structured list data.
6. Formatted Printing
for (int i = 0; i < 100; i += 5) {
Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i).ToString());
Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i+1).ToString());
Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i+2).ToString());
Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i+3).ToString());
Ā Ā Ā Ā <J7PRINT>(" " + ar.get(i+4).ToString());
Ā Ā Ā Ā <PRINTLN>("<BR>");
}
Prints the data in rows of 5 values (like A1, A2, A3, A4, A5 format).
Ensures readability in HTML output with <BR> line breaks.
7. Session Value Display
<PRINTLN>("<B> Session value of seqno1 </B> = " + Program.list1.getSessionValue("seqno1"));
Retrieves and prints the stored session value (2000 values).
8. Context and Config Display
<PRINTLN>("<B> OakJava7Context </B> = " + Program.list.get(0).ToString());
<PRINTLN>("<B> Java7config </B> = " + Java7Config.getParameter("Driver"));
Prints the secret context (Secretno=1089678).
Prints the JDBC driver configuration (sun.jdbc.Driver).
9. Error Handling
<CATCH> (Exception e) {
Ā Ā Ā Ā <PRINTLN>("Error.... " + e);
}
Catches and prints any runtime errors.
10. Finally Block
<Finally> {
Ā Ā Ā Ā <PRINTLN>("The Finally block is executed...");
}
Ensures a final message is always printed, regardless of success or error.
Web Integration: Displays HTML and session data in a browser.
Session Tracking: Retrieves values stored in Program.p().
Data Conversion: Converts between list, string, and array formats.
Formatted Output: Prints values in structured rows for readability.
Error Handling: Uses TRYāCATCHāFINALLY for robust execution.
š In short:
This Dotweb5.0 program loads an HTML design, retrieves session data, converts it into structured arrays, prints values in a formatted table, and displays session/context/config information with error handling and a final execution message.
Together, these two programs demonstrate Dotweb5.0ās session context capabilities:
Program 1 (sessiontracking.web) ā Defines and forwards data, sets session values, and assigns context.
Program 2 (sessiontracks.web) ā Retrieves forwarded data, session values, context values, and configuration parameters, while handling errors gracefully.
Program 1 (sessiontracking.web)
Creates and forwards two ArrayLists (language0, language1).
Sets session values (seqno1, seqno2, seqno3).
Assigns a unique context (Secretno=1089678).
Prepares configuration values (e.g., Driver).
Program 2 (sessiontracks.web)
Retrieves forwarded data (language0).
Accesses session values (seqno1).
Reads the shared context (Secretno).
Fetches configuration parameters (Driver).
Uses TRY, CATCH, and Finally blocks for error handling.
The Session Context Flow in Dotweb5.0 defines how data travels between web programs using secure session objects, context references, and configuration parameters. It ensures that stateful information (like user data, configuration, and temporary lists) is preserved and shared across multiple web modules ā similar to Javaās servlet session handling, but with enhanced security and modularity.
Manages sessionāspecific data such as temporary variables, counters, or user details.
Example: seqno1 = 2000 values, No of employees = 1000
Stores secure configuration or secret parameters shared across modules.
Example: Secretno = 1089678
Transfers structured data between programs or pages for modular execution.
Example: Forward("language0", la)
Retrieves systemālevel configuration like drivers or environment settings.
Example: Java7Config.getParameter("Driver")
Program 1: sessiontracking.web
Initializes session and context data.
Creates structured lists (language0, language1) using LArray and J7ArrayList.
Forwards these lists using the forward object.
Acts as the data producer.
Program 2: sessiontracks.web
Retrieves forwarded data using getForwardValue("language0").
Converts and formats the data for display.
Accesses session and context values (seqno1, Secretno, Driver).
Acts as the data consumer.
Program 1 (sessiontracking.web)
Ā Ā Ā ā
[Forward Data + Session + Context + Config]
Ā Ā Ā ā
Program 2 (sessiontracks.web)
Ā Ā Ā ā
[Retrieve + Convert + Display]
Ā Ā Ā ā
HTML Output (Browser View)
Forward Data ā Transmits structured lists.
Session Data ā Maintains runtime variables.
Context Data ā Shares secure configuration.
Config Parameter ā Provides system driver or environment info.
Secure Session Isolation
Each session object is sandboxed ā preventing unauthorized access between users or modules.
Context Synchronization
The Java7Context ensures consistent configuration across distributed web components.
Forward Chaining
Enables modular program design ā one web file can forward data to another seamlessly.
AutoBox Conversion
Converts string data into structured arrays automatically for easy iteration and display.
HTML Integration
The J7HTML.displayhtml() method binds backend session data to frontāend templates.
Think of ProgramāÆ1 as a data warehouse that prepares and secures information,
and ProgramāÆ2 as a report generator that fetches, formats, and displays it dynamically in the browser.
This flow demonstrates Dotweb5.0ās hybrid design philosophy ā blending Javaālike syntax with webāspecific constructs (<WEB>, <USE>, <PACK>, <CLASS>).
Itās ideal for secure enterprise web applications, where data continuity and modularity are critical.
Forward ā Moves lists or values between pages.
Java7Session ā Tracks session data with keyāvalue pairs.
Java7Context ā Acts as shared memory across servlets.
Java7Config ā Retrieves configuration parameters from files.
TheĀ DiagramĀ forĀ Dotweb5.0 WorkFlowĀ isĀ given below.....
š OUTPUT : Ā Forward Data, Session Data, ContextValue, Config parameter are printed.
=============================================================================================================
A school has Class A, Class B, and Class C.
Students in Class A are shifted to Class B.
Students in Class B are shifted to Class C.
Students in Class C exit the school.
New students join Class A.
We use Stack and J7HashMap collections with keyāvalue pairs to manage this.
Initial students: Alice, Bob, Charlie.
First Shift: Class A ā Class B, Class B ā Class C.
Add new students: David, Eva to Class A.
Second Shift: Class B ā Class C, Class A ā Class B, Class A becomes empty.
Finally, display Class A, B, and C data in a Pie Chart to represent percentages.
<WEB>
<USE> format;
<PACK> studmgt {
Ā Ā <CLASS> School {
Ā Ā Ā Ā OJ7Lib.J7HashMap classes = new OJ7Lib.J7HashMap();
Ā Ā Ā Ā public School() {
Ā Ā Ā Ā Ā Ā Ā classes.put("ClassA", new OJ7Lib.<VList><STACK>(10));
Ā Ā Ā Ā Ā Ā Ā classes.put("ClassB", new OJ7Lib.<VList><STACK>(10));
Ā Ā Ā Ā Ā Ā Ā classes.put("ClassC", new OJ7Lib.<VList><STACK>(10));
Ā Ā Ā Ā }
Ā Ā Ā Ā // Add new students to Class A
Ā Ā Ā Ā OJ7Lib.<VList><STACK> classA1 = new OJ7Lib.<VList><STACK>(10);
Ā Ā Ā Ā OJ7Lib.<VList><STACK> classB1 = new OJ7Lib.<VList><STACK>(10);
Ā Ā Ā Ā OJ7Lib.<VList><STACK> classC1 = new OJ7Lib.<VList><STACK>(10);
Ā Ā Ā Ā public void addNewStudents(OJ7Lib.J7ArrayList newStudents) {
Ā Ā Ā Ā Ā Ā Ā Ā classA1.<PUSH>(newStudents);
Ā Ā Ā Ā }
Ā Ā Ā Ā // Shift students: A -> B, B -> C, C -> Outside
Ā Ā Ā Ā public void shiftClasses() {
Ā Ā Ā Ā Ā Ā Ā OJ7Lib.<VList><STACK> classA = classA1;
Ā Ā Ā Ā Ā Ā Ā OJ7Lib.<VList><STACK> classB = classB1;
Ā Ā Ā Ā Ā Ā Ā OJ7Lib.<VList><STACK> classC = classC1;
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Students leaving school: " + classC1);
Ā Ā Ā Ā Ā Ā Ā classC.clear();
Ā Ā Ā Ā Ā Ā Ā while (!classB.isEmpty()) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā classC.<PUSH>(classB.<POP>);
Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā while (!classA.isEmpty()) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā classB.<PUSH>(classA.<POP>);
Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā classA1 = classA;
Ā Ā Ā Ā Ā Ā Ā classB1 = classB;
Ā Ā Ā Ā Ā Ā Ā classC1 = classC;
Ā Ā Ā Ā }
Ā Ā Ā Ā // Display current state
Ā Ā Ā Ā public void displayClasses() {
Ā Ā Ā Ā Ā Ā J7HTML.displayhtml("organizationchart.html");
Ā Ā Ā Ā Ā Ā String classa = "ClassA = " + classA1.ToString().Replace("["," ").Replace("]"," ").Replace(",","");
Ā Ā Ā Ā Ā Ā String classb = "ClassB = " + classB1.ToString().Replace("["," ").Replace("]"," ").Replace(",","");
Ā Ā Ā Ā Ā Ā String classc = "ClassC = " + classC1.ToString().Replace("["," ").Replace("]"," ").Replace(",","");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // In class A , Class A teacher isĀ waiting for the student to join that's why 1 is added to Class A.
Ā Ā Ā Ā Ā Ā <PRINTLN>("['"+classa+"'"+","+1+"],");
Ā Ā Ā Ā Ā Ā <PRINTLN>("['"+classb+"'"+","+3+"],");
Ā Ā Ā Ā Ā Ā <PRINTLN>("['"+classc+"'"+","+3+"]");
Ā Ā Ā Ā Ā Ā J7HTML.displayhtml("organizationchart1.html");
Ā Ā Ā Ā }
Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā School school = new School();
Ā Ā Ā Ā Ā Ā Ā Ā // Initial students in Class A
Ā Ā Ā Ā Ā Ā Ā Ā OJ7Lib.J7ArrayList initialStudents = new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā Ā Ā Ā Ā initialStudents.add("Alice");
Ā Ā Ā Ā Ā Ā Ā Ā initialStudents.add("Bob");
Ā Ā Ā Ā Ā Ā Ā Ā initialStudents.add("Charlie");
Ā Ā Ā Ā Ā Ā Ā Ā school.addNewStudents(initialStudents);
Ā Ā Ā Ā Ā Ā Ā Ā school.displayClasses();
Ā Ā Ā Ā Ā Ā Ā Ā // First shift
Ā Ā Ā Ā Ā Ā Ā Ā school.shiftClasses();
Ā Ā Ā Ā Ā Ā Ā Ā school.displayClasses();
Ā Ā Ā Ā Ā Ā Ā Ā // Add new students
Ā Ā Ā Ā Ā Ā Ā Ā OJ7Lib.J7ArrayList newStudents = new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā Ā Ā Ā Ā newStudents.add("David");
Ā Ā Ā Ā Ā Ā Ā Ā newStudents.add("Eva");
Ā Ā Ā Ā Ā Ā Ā Ā school.addNewStudents(newStudents);
Ā Ā Ā Ā Ā Ā Ā Ā school.displayClasses();
Ā Ā Ā Ā Ā Ā Ā Ā // Second shift
Ā Ā Ā Ā Ā Ā Ā Ā school.shiftClasses();
Ā Ā Ā Ā Ā Ā Ā Ā school.displayClasses();
Ā Ā Ā Ā }
Ā Ā }
}
Add new students to Class A ā Push new student list into Class A stack.
Shift students: A ā B, B ā C, C ā Outside ā Clear Class C, move Class B to Class C, move Class A to Class B.
Display current state ā Print Class A, B, and C values, format them, and show in a Pie Chart.
Initial students ā Alice, Bob, Charlie added to Class A.
First shift ā Class A ā B, Class B ā C.
Add new students ā David and Eva added to Class A.
Second shift ā Class B ā C, Class A ā B, Class A becomes empty.
In class A Ā : Class A teacher isĀ waiting for the student to join that's why 1 is added to Class A.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
class School {
Ā Ā Ā Ā private HashMap<String, Stack<String>> classes;
Ā Ā Ā Ā public School() {
Ā Ā Ā Ā Ā Ā Ā Ā classes = new HashMap<String, Stack<String>>();
Ā Ā Ā Ā Ā Ā Ā Ā classes.put("ClassA", new Stack<String>());
Ā Ā Ā Ā Ā Ā Ā Ā classes.put("ClassB", new Stack<String>());
Ā Ā Ā Ā Ā Ā Ā Ā classes.put("ClassC", new Stack<String>());
Ā Ā Ā Ā }
Ā Ā Ā Ā // Add new students to Class A
Ā Ā Ā Ā public void addNewStudents(List<String> newStudents) {
Ā Ā Ā Ā Ā Ā Ā Ā Stack<String> classA = classes.get("ClassA");
Ā Ā Ā Ā Ā Ā Ā Ā for (String student : newStudents) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā classA.push(student);
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā }
Ā Ā Ā Ā // Shift students: A -> B, B -> C, C -> Outside
Ā Ā Ā Ā public void shiftClasses() {
Ā Ā Ā Ā Ā Ā Ā Ā Stack<String> classA = classes.get("ClassA");
Ā Ā Ā Ā Ā Ā Ā Ā Stack<String> classB = classes.get("ClassB");
Ā Ā Ā Ā Ā Ā Ā Ā Stack<String> classC = classes.get("ClassC");
Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("Students leaving school: " + classC);
Ā Ā Ā Ā Ā Ā Ā Ā classC.clear();
Ā Ā Ā Ā Ā Ā Ā Ā while (!classB.isEmpty()) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā classC.push(classB.pop());
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā while (!classA.isEmpty()) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā classB.push(classA.pop());
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā }
Ā Ā Ā Ā // Display current state
Ā Ā Ā Ā public void displayClasses() {
Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("Class A: " + classes.get("ClassA"));
Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("Class B: " + classes.get("ClassB"));
Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("Class C: " + classes.get("ClassC"));
Ā Ā Ā Ā }
}
public class SchoolDemo {
Ā Ā Ā Ā public static void main(String[] args) {
Ā Ā Ā Ā Ā Ā Ā Ā School school = new School();
Ā Ā Ā Ā Ā Ā Ā Ā // Initial students in Class A
Ā Ā Ā Ā Ā Ā Ā Ā List<String> initialStudents = new ArrayList<String>();
Ā Ā Ā Ā Ā Ā Ā Ā initialStudents.add("Alice");
Ā Ā Ā Ā Ā Ā Ā Ā initialStudents.add("Bob");
Ā Ā Ā Ā Ā Ā Ā Ā initialStudents.add("Charlie");
Ā Ā Ā Ā Ā Ā Ā Ā school.addNewStudents(initialStudents);
Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("Initial state:");
Ā Ā Ā Ā Ā Ā Ā Ā school.displayClasses();
Ā Ā Ā Ā Ā Ā Ā Ā // First shift
Ā Ā Ā Ā Ā Ā Ā Ā school.shiftClasses();
Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("\nAfter first shifting:");
Ā Ā Ā Ā Ā Ā Ā Ā school.displayClasses();
Ā Ā Ā Ā Ā Ā Ā Ā // Add new students
Ā Ā Ā Ā Ā Ā Ā Ā List<String> newStudents = new ArrayList<String>();
Ā Ā Ā Ā Ā Ā Ā Ā newStudents.add("David");
Ā Ā Ā Ā Ā Ā Ā Ā newStudents.add("Eva");
Ā Ā Ā Ā Ā Ā Ā Ā school.addNewStudents(newStudents);
Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("\nAfter adding new students:");
Ā Ā Ā Ā Ā Ā Ā Ā school.displayClasses();
Ā Ā Ā Ā Ā Ā Ā Ā // Second shift
Ā Ā Ā Ā Ā Ā Ā Ā school.shiftClasses();
Ā Ā Ā Ā Ā Ā Ā Ā System.out.println("\nAfter second shifting:");
Ā Ā Ā Ā Ā Ā Ā Ā school.displayClasses();
Ā Ā Ā Ā }
}
organizationchart.html
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages:["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['ABCSCHOOLSECTION', 'StudentList'],
organizationchart1.html
]);
var options = {
title: 'ABC School',
is3D: true,
};
var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="piechart_3d" style="width: 900px; height: 500px;"></div>
</body>
</html>
Concepts are identical ā Both use Stacks, HashMaps, and ArrayLists.
Syntax differs ā Dotweb5.0 uses <WEB>, <PACK>, <CLASS>, <PRINTLN>, and OakJava7 libraries. Java uses standard class, System.out.println, and java.util collections.
Integration ā Dotweb5.0 integrates directly with HTML output (J7HTML.displayhtml) for visualization, while Java requires separate HTML files.
Family Relationship ā Dotweb5
š OUTPUT : use soweb Theme, pie chart for class A, class B, class C
========================================================================================================
==============================================================================================
<WEB>
<PACK> ScrollServer {
Ā Ā <CLASS> Programs {
Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā <TRY> {
Ā Ā Ā Ā Ā Ā Ā Ā // Display the login page
Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("j7UserLogin.html");Ā
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā <CATCH> (Exception e) {
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Error.... " + e);
Ā Ā Ā Ā Ā Ā }Ā Ā
Ā Ā Ā Ā Ā Ā <Finally> {
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("The Finally block is executed...");
Ā Ā Ā Ā Ā Ā }Ā
Ā Ā Ā Ā }
Ā Ā }
}
Purpose: This servlet loads the login page (j7UserLogin.html).
Error Handling: Uses <TRY>, <CATCH>, and <Finally> blocks to ensure stability.
Design: Acts as the entry point for the user login system.
<head>
Ā Ā <title>User Login</title>
Ā Ā <!-- Load stylesheet with Modal Box theme -->
Ā Ā <link rel="stylesheet" href="http://localhost:8082/modelbox1.WS">
</head>
<body background="https://picsum.photos/200/300/?random" bgcolor="gold">
<button onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Sign Up</button>
<div id="id01" class="modal">
Ā Ā <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
Ā Ā <form class="modal-content" action="http://localhost:9000/OakJ7Process.web5" method="post">
Ā Ā Ā Ā <div class="container">
Ā Ā Ā Ā Ā Ā <h2>Enter your Details</h2>
Ā Ā Ā Ā Ā Ā <p><label> User Name: <input type="text" name="uname" size="25" /></label></p>
Ā Ā Ā Ā Ā Ā <p><label> Password: <input type="password" name="password" size="15" /></label></p>
Ā Ā Ā Ā Ā Ā <div class="clearfix">
Ā Ā Ā Ā Ā Ā Ā Ā <input type="submit" name="Click">
Ā Ā Ā Ā Ā Ā Ā Ā <input type="reset" name="Clear">
Ā Ā Ā Ā Ā Ā </div>
Ā Ā Ā Ā </div>
Ā Ā Ā Ā <div class="container" style="background-color:#f1f1f1">
Ā Ā Ā Ā Ā Ā <p align="center">Jemin Information Technology 2024 (C) All Rights Reserved</p>
Ā Ā Ā Ā </div>
Ā Ā </form>
Ā Ā <script>
Ā Ā Ā Ā // Close modal when clicking outside
Ā Ā Ā Ā var modal = document.getElementById('id01');
Ā Ā Ā Ā window.onclick = function(event) {
Ā Ā Ā Ā Ā Ā if (event.target == modal) {
Ā Ā Ā Ā Ā Ā Ā Ā modal.style.display = "none";
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā }
Ā Ā </script>
</body>
</html>
Modal Box Theme: Attractive login form styled with modelbox1.WS.
Background: Random image with golden theme for elegance.
Form Fields: Username and password inputs.
Actions: Submit sends data to OakJ7Process.web5; reset clears inputs.
Footer: Copyright notice.
JavaScript: Closes modal when clicking outside.
<JAVA>
<USE> <OJ7UTIL>;
<USE> fx;
<PACK> Program5 {
Ā Ā <CLASS> Prog {
Ā Ā Ā Ā static int count = 0;
Ā Ā Ā Ā public void main() {
StringĀ params ="uname,password,NOT";
Ā Ā Ā Ā Ā Ā <PRINTLN>("<!DOCTYPE html>");
Ā Ā Ā Ā Ā Ā HTML.displayhtml("style.html");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<BODY bgcolor=gold>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<form>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<P align=right> User Logout click me <a href=http://localhost:9000/ScrollServerLogin.web5> LOGOUT </a>");
OJ7Lib.J7ArrayList armg= Dotweb5.Lib.AddDotWebJ7Request("OakJ7Processoj7.dsn" ,Dotweb5.Lib.AddArrayListData(params),2,1 );
Ā Ā Ā Ā Ā Ā string r = armg.get(0).ToString();Ā Ā Ā
Ā Ā Ā Ā Ā Ā string pwd = armg.get(1).ToString();Ā
Ā Ā Ā Ā Ā Ā String uname = FileSequentialAccess.Read("users3.txt");
Ā Ā Ā Ā Ā Ā String password = FileSequentialAccess.Read("password.txt");
Ā Ā Ā Ā Ā Ā int t6 = 0;
Ā Ā Ā Ā Ā Ā if ((r == "admin") && (pwd.Trim() == password.Trim())) {
Ā Ā Ā Ā Ā Ā Ā Ā if (count == 0) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā FileSequentialAccess.Write("users3.txt", r);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā FileSequentialAccess.Write("password.txt", pwd);
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā t6 = 1; count++;
Ā Ā Ā Ā Ā Ā } else {
Ā Ā Ā Ā Ā Ā Ā Ā t6 = 0;
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā if (t6 == 1) {
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<P align=left> USER : " + uname + "</p><br>");
Ā Ā Ā Ā Ā Ā } else {
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("Invalid username");
Ā Ā Ā Ā Ā Ā Ā Ā FileSequentialAccess.Write("users3.txt", " ");
Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā <PRINTLN>("</form>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("</html>");
Ā Ā Ā Ā Ā Ā <PRINTLN>("<P align=center> Jemin Information Technology 2024 (C) All Rights Reserved </P>");
Ā Ā Ā Ā }
Ā Ā }
}
Purpose: Validates login credentials.
Data Handling: Reads username and password from files (users3.txt, password.txt).
Validation: Checks if input matches stored credentials.
Session Control: Writes user data to file on first login.
Logout: Provides logout link at topāright corner.
Error Handling: Displays āInvalid usernameā if credentials fail.
Program 1 (Servlet): Loads the login page.
Program 2 (HTML): Attractive modal box login form with username and password fields.
Program 3 (Backend): Validates credentials, manages session, and provides logout.
š OUTPUT : ModelBox green Button,Login page, Second page with LogOutĀ
===============================================================================================================
==============================================================================================================
A cookie is a small piece of data that a web server sends to a userās browser. The browser stores this data and sends it back to the server with subsequent requests. Cookies are primarily used to remember user information, maintain sessions, and personalize web experiences.
A cookie is essentially a text file containing data such as a user ID, session token, or preferences. This file is stored in the browser and helps the server recognize returning users.
Cookies can be created using the CreateCookie command.
Ā
Syntax:
CreateCookie = {sessionId=1gh7889999, localhost, /, 3600}!
This creates a cookie with a session ID and a specified lifespan.
Cookies can be updated using the UpdateCookie command.
Ā
Syntax:
UpdateCookie = {sessionId=100000567Lpgq}!
This updates the existing cookie with a new session ID.
Cookies can be deleted using the DeleteCookie command.
Syntax:
DeleteCookie = {username=jackee}!
This removes the cookie associated with the given username.
CreateCookie = {username=wilmixjemin, localhost, /, 3600}!
=> Creates a cookie with username = wilmixjemin
UpdateCookie = {username=jackee}!
=> Updates the username to jackee
DeleteCookie = {username=jackee}!
=> Deletes the cookie with username = jackee
The Dotweb5.0 cookie system is more advanced than cookie implementations in other programming languages. For security and intellectual property reasons, only 50% of the details are shared here. The full advanced cookie concept will be available in Dotweb5.0 Enterprise Edition.
================================================================================================================
================================================================================================================
Ram begins his financial journey with a large deposit and several business transactions. The sequence is as follows:
Initial Deposit: Ram deposits ā¹1 crore into his account at ABC Bank (A/C IC6789).
Household Purchases: He spends ā¹3 lakhs on household items.
Wood & Paint Purchases: He spends ā¹50,000 on wood and paint.
New Investment: After one week, Ram invests ā¹30 lakhs to start a new company.
Company Foundation: He spends ā¹20 lakhs on the companyās foundation.
Loss: After one year, the company incurs a loss of ā¹10 lakhs.
Partnership: Ram and his best friend decide to start a combined business.
Use OakJava7 ArrayList packages to store transaction data.
Use Bag collection instead of J7HashMap for managing grouped values.
Display the transactions in a tabular format with Zebra Stripes design (alternating row colors for readability).
ArrayList: Stores each transaction sequentially.
Bag Collection: Groups transactions by type (e.g., deposits, purchases, investments).
Zebra Stripes: Alternating row colors in the table improve readability and give a professional look.
Ledger Flow: Each transaction updates the running balance, showing Ramās financial journey clearly.
This scenario demonstrates how OakJava7 collections can be used to manage business transactions in a structured way. By using ArrayList and Bag collections, we can store and group data efficiently. The Zebra Stripes table design ensures that the ledger is visually appealing and easy to interpret.
š» Program ā studmgt.J7LedgerĀ
<WEB>
<PACK> studmgt {
Ā Ā <CLASS> J7Ledger {
Ā Ā Ā
Ā Ā Ā Ā Bag ledger = new Bag();
Ā Ā Ā Ā OJ7Lib.J7ArrayList additems = new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā OJ7Lib.J7ArrayList dates = new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā public J7Ledger() {
Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā // put Transaction Labels and Amount at Bag datastructures , Bag DataStructures contains key and value pairs, it can be used for Tree format,Ā
Ā Ā Ā Ā Ā Ā Ā // we can add items to the Bag using PUT statement
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Day 1: Deposit at ABC Bank (A/C IC6789)", 10000000.0); // 1 Crore
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Day 2: Household Purchases", -300000.0); // 3 Lakhs spent
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Day 3: Wood & Paint Purchases", -50000.0); // 50,000 spent
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Week 1: Investment in New Company", -3000000.0); // 30 Lakhs invested
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Week 1: Company Foundation Expenses", -2000000.0); // 20 Lakhs spent
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Year 1: Company Loss", -1000000.0); // 10 Lakhs loss
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Year 1: Joint Business with Friend", 0.0); // Placeholder
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Add to the OakJava7 arrayList additems using add statement
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Day 1: Deposit at ABC Bank (A/C IC6789)"); // 1 Crore
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Day 2: Household Purchases"); // 3 Lakhs spent
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Day 3: Wood & Paint Purchases"); // 50,000 spent
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Week 1: Investment in New Company"); // 30 Lakhs invested
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Week 1: Company Foundation Expenses"); // 20 Lakhs spent
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Year 1: Company Loss"); // 10 Lakhs loss
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Year 1: Joint Business with Friend"); // Placeholder
Ā Ā Ā Ā Ā Ā Ā Ā // Add dates separately
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2007");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2007");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2008");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2008");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2007");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2009");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2009");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2010");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2011");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2012");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2018");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2025");
Ā Ā Ā Ā }
Ā Ā Ā Ā // Display current state
Ā Ā Ā Ā public void displayFormatA() {
Ā Ā Ā Ā Ā Ā Ā // Display ledger in tabular format
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");<PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<HR><B>Ram's Business Ledger Statement<B> <HR>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");<PRINTLN>("<BR>");<PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā // Add Zebra types table DesignĀ
Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("zebra.html");
Ā Ā Ā Ā Ā Ā Ā // Add Ledger headers
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>"); <PRINTLN>("Date/Stage"); <PRINTLN>("</th>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>"); <PRINTLN>("Transcation"); <PRINTLN>("</th>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>"); <PRINTLN>("Amount (Rs.)"); <PRINTLN>("</th>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>"); <PRINTLN>("Running Balance (Rs.)"); <PRINTLN>("</th>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā }
Ā Ā Ā Ā public void displayFormatB() {
Ā Ā Ā Ā Ā Ā Ā Ā double runningBalance = 0.0;
Ā Ā Ā Ā Ā Ā Ā Ā double amount = 0.0;
Ā Ā Ā Ā Ā Ā Ā Ā for(int i=0;i<additems.size();i++) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // pass the value of arraylist additems , this will return Transcations labels as Key
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // use Ledger to get the value using Transaction label keysĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // remove [ or ] from the list additems
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā var amtstr = ledger.get(additems.get(i).ToString().Replace("[","").Replace("]",""));
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā amount = Convert.ToDouble(amtstr.ToString().Replace("[","").Replace("]",""));
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // combine all the amount and add it to runningBalance
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā runningBalance += amount;
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // get dates from arraylist dates
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(dates.get(i));
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Add Transaction labels as Key
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(additems.get(i).ToString().Replace("[","").Replace("]",""));
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Add amount to the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(amount);Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Add runningBalance to the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(runningBalance);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<B>Final Balance</B>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</td>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>"); <PRINTLN>("Ā "); <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>"); <PRINTLN>("Ā "); <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā // Add TotalBalance to table
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(runningBalance);
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</Table>");
Ā Ā Ā Ā Ā Ā Ā Ā // Close ZEBRA design for the Table
Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("zebra1.html");
Ā Ā Ā Ā }
Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā J7Ledger ledger = new J7Ledger();
Ā Ā Ā Ā Ā Ā Ā Ā // Add table Headers and Zebra type design
Ā Ā Ā Ā Ā Ā Ā Ā ledger.displayFormatA();
Ā Ā Ā Ā Ā Ā Ā Ā // Add all the required data and close the zebra type design
Ā Ā Ā Ā Ā Ā Ā Ā ledger.displayFormatB();
Ā Ā Ā Ā }
Ā Ā }
}
<WEB>
<PACK> studmgt {
Ā Ā <CLASS> J7Ledger {
Ā Ā Ā
Ā Ā Ā Ā Bag ledger = new Bag();
Ā Ā Ā Ā OJ7Lib.J7ArrayList additems = new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā OJ7Lib.J7ArrayList dates = new OJ7Lib.J7ArrayList();
Ā Ā Ā Ā public J7Ledger() {
Ā Ā Ā Ā
Ā Ā Ā Ā Ā Ā Ā // put Transaction Labels and Amount at Bag datastructures , Bag DataStructures contains key and value pairs, it can be used for Tree format,Ā
Ā Ā Ā Ā Ā Ā Ā // we can add items to the Bag using PUT statement
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Day 1: Deposit at ABC Bank (A/C IC6789)", 10000000.0); // 1 Crore
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Day 2: Household Purchases", -300000.0); // 3 Lakhs spent
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Day 3: Wood & Paint Purchases", -50000.0); // 50,000 spent
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Week 1: Investment in New Company", -3000000.0); // 30 Lakhs invested
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Week 1: Company Foundation Expenses", -2000000.0); // 20 Lakhs spent
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Year 1: Company Loss", -1000000.0); // 10 Lakhs loss
Ā Ā Ā Ā Ā Ā Ā Ā ledger.PUT("Year 1: Joint Business with Friend", 0.0); // Placeholder
Ā Ā Ā Ā Ā Ā Ā Ā Ā // Add to the OakJava7 arrayList additems using add statement
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Day 1: Deposit at ABC Bank (A/C IC6789)"); // 1 Crore
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Day 2: Household Purchases"); // 3 Lakhs spent
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Day 3: Wood & Paint Purchases"); // 50,000 spent
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Week 1: Investment in New Company"); // 30 Lakhs invested
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Week 1: Company Foundation Expenses"); // 20 Lakhs spent
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Year 1: Company Loss"); // 10 Lakhs loss
Ā Ā Ā Ā Ā Ā Ā Ā Ā additems.add("Year 1: Joint Business with Friend"); // Placeholder
Ā Ā Ā Ā Ā Ā Ā Ā // Add dates separately
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2007");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2007");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2008");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2008");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2007");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2009");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2009");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2010");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2011");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2012");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2018");
Ā Ā Ā Ā Ā Ā Ā Ā dates.add("12-02-2025");
Ā Ā Ā Ā }
Ā Ā Ā Ā // Display current state
Ā Ā Ā Ā public void displayFormatA() {
Ā Ā Ā Ā Ā Ā Ā // Display ledger in tabular format
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");<PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<HR><B>Ram's Business Ledger Statement<B> <HR>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<BR>");<PRINTLN>("<BR>");<PRINTLN>("<BR>");
Ā Ā Ā Ā Ā Ā Ā // Add Zebra types table DesignĀ
Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("zebra.html");
Ā Ā Ā Ā Ā Ā Ā // Add Ledger headers
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>"); <PRINTLN>("Date/Stage"); <PRINTLN>("</th>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>"); <PRINTLN>("Transcation"); <PRINTLN>("</th>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>"); <PRINTLN>("Amount (Rs.)"); <PRINTLN>("</th>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<th>"); <PRINTLN>("Running Balance (Rs.)"); <PRINTLN>("</th>");
Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā }
Ā Ā Ā Ā public void displayFormatB() {
Ā Ā Ā Ā Ā Ā Ā Ā double runningBalance = 0.0;
Ā Ā Ā Ā Ā Ā Ā Ā double amount = 0.0;
Ā Ā Ā Ā Ā Ā Ā Ā for(int i=0;i<additems.size();i++) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // pass the value of arraylist additems , this will return Transcations labels as Key
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // use Ledger to get the value using Transaction label keysĀ
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // remove [ or ] from the list additems
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā var amtstr = ledger.get(additems.get(i).ToString().Replace("[","").Replace("]",""));
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā amount = Convert.ToDouble(amtstr.ToString().Replace("[","").Replace("]",""));
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // combine all the amount and add it to runningBalance
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā runningBalance += amount;
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TR>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // get dates from arraylist dates
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(dates.get(i));
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Add Transaction labels as Key
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(additems.get(i).ToString().Replace("[","").Replace("]",""));
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Add amount to the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(amount);Ā
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā // Add runningBalance to the table
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(runningBalance);
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<tr>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<td>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<B>Final Balance</B>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</td>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>"); <PRINTLN>("Ā "); <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>"); <PRINTLN>("Ā "); <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("<TD>");
Ā Ā Ā Ā Ā Ā Ā Ā // Add TotalBalance to table
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>(runningBalance);
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</TD>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</tr>");
Ā Ā Ā Ā Ā Ā Ā Ā <PRINTLN>("</Table>");
Ā Ā Ā Ā Ā Ā Ā Ā // Close ZEBRA design for the Table
Ā Ā Ā Ā Ā Ā Ā Ā HTML.displayhtml("zebra1.html");
Ā Ā Ā Ā }
Ā Ā Ā Ā public void main() {
Ā Ā Ā Ā Ā Ā Ā Ā J7Ledger ledger = new J7Ledger();
Ā Ā Ā Ā Ā Ā Ā Ā // Add table Headers and Zebra type design
Ā Ā Ā Ā Ā Ā Ā Ā ledger.displayFormatA();
Ā Ā Ā Ā Ā Ā Ā Ā // Add all the required data and close the zebra type design
Ā Ā Ā Ā Ā Ā Ā Ā ledger.displayFormatB();
Ā Ā Ā Ā }
Ā Ā }
}
Comment: āput Transaction Labels and Amount at Bag datastructuresā¦ā
Explanation: The Bag collection stores keyāvalue pairs (transaction label and amount). It can be used like a tree structure. Transactions are added using the PUT statement.
Comment: āAdd to the OakJava7 arrayList additems using add statementā¦ā
Explanation: Each transaction label is also stored in an ArrayList for sequential access and iteration.
Comment: āAdd dates separatelyā¦ā
Explanation: Dates are stored in a separate ArrayList to align each transaction with its respective date.
Comment: āDisplay ledger in tabular formatā¦ā
Explanation: The ledger is displayed as a table with headers for Date/Stage, Transaction, Amount, and Running Balance.
Comment: āAdd Zebra types table Designā¦ā
Explanation: A zebra-striped table design is used for readability, alternating row colors.
Comment: āAdd Ledger headersā¦ā
Explanation: Table headers are defined for each column in the ledger.
Comment: āpass the value of arraylist additems, this will return Transaction labels as Keyā¦ā
Explanation: Each transaction label from the ArrayList is used as a key to fetch its corresponding amount from the Bag.
Comment: ācombine all the amount and add it to runningBalanceā¦ā
Explanation: Each transaction amount is added to a cumulative running balance to track financial flow.
Comment: āAdd TotalBalance to tableā¦ā
Explanation: At the end of the table, the final balance is displayed in bold.
Comment: āClose ZEBRA design for the Tableā¦ā
Explanation: The zebra-striped table is closed and finalized with zebra1.html.
This program demonstrates how to build a business ledger in Dotweb5.0 using:
Bag Collection for keyāvalue transaction storage.
ArrayList for sequential transaction labels and dates.
Zebra Table Design for attractive, readable output.
Running Balance Calculation to track financial status after each transaction.
=======================================
Hereās a polished and standard English formatted explanation of why the Bag utility in Dotweb5.0 is considered more advanced than traditional ArrayList implementations across programming languages, presented with attractive design.
While most programming languages provide ArrayList or similar sequential collections, Dotweb5.0 introduces the Bag utility ā a powerful data structure that combines the simplicity of lists with the flexibility of keyāvalue mappings. This makes Bag more advanced and versatile than any ArrayList implementation found in mainstream languages today.
Human-Centric Design: Instead of numeric indices, Bag allows descriptive keys, making data more meaningful.
Hierarchical Capability: Bag can represent tree structures, enabling advanced ledger or organizational charts.
Combined Strengths: It merges the sequential nature of lists with the associative power of maps.
Ease of Reporting: Perfect for generating tabular outputs (e.g., Zebra-striped ledgers) with clear transaction labels.
Advanced Integration: Works natively with Dotweb5.0ās HTML display utilities, making it ideal for business applications.
The Bag utility in Dotweb5.0 is not just a collection ā it is a hybrid data structure that surpasses traditional ArrayLists by offering:
Keyāvalue storage,
Hierarchical representation,
Seamless integration with reporting tools,
Greater readability and usability for real-world business scenarios.
In short, Bag is a next-generation collection type that elevates Dotweb5.0 above conventional programming paradigms, making it uniquely suited for advanced ledger systems, enterprise applications, and structured data visualization.
Hereās your infographic ā it visually compares the Bag Utility in Dotweb5.0 with the traditional ArrayList, highlighting why Bag is more advanced and businessāready.
Bag Utility in Dotweb5.0 goes beyond simple sequential storage.
It combines keyāvalue mapping, hierarchical structures, and ledgerāstyle organization.
Compared to ArrayList, Bag offers better readability, advanced reporting, and businessāready integration.
Hierarchical Data: Supports treeālike structures for complex records.
Enhanced Reporting: Works seamlessly with Zebra tables and HTML outputs.
Business Ready: Perfect for ledgers, financial statements, and enterprise applications.
The Bag utility is not just a collection ā itās a hybrid powerhouse that merges the strengths of lists and maps. With its ability to handle structured, descriptive, and hierarchical data, Bag is far more advanced than any ArrayList implementation in todayās programming languages.
Hereās your infographic ā it beautifully illustrates why the Bag Utility in Dotweb5.0 is far more advanced than the traditional HashMap found in other programming languages.
The Bag utility in Dotweb5.0 redefines how developers handle data. While a HashMap provides basic keyāvalue mapping, Bag extends this concept with hierarchical organization, integrated reporting, and businessāready persistence. Itās not just a data structure ā itās a complete dataāmanagement framework.
Hierarchical Storage: Enables treeālike data organization for multiālevel relationships.
Rich Reporting Tools: Works seamlessly with Dotweb5.0ās HTML and Zebra table utilities.
Enterprise Ready: Designed for ledgers, accounting systems, and business dashboards.
Smart Data Handling: Supports both sequential and associative access patterns.
Persistence: Retains data beyond runtime, unlike transient HashMaps.
The Bag utility in Dotweb5.0 transcends the limitations of HashMap by combining structure, intelligence, and presentation. Itās not just about storing data ā itās about organizing, visualizing, and managing it efficiently.
In short, Bag is the evolution of HashMap, tailored for modern enterprise applications where clarity, hierarchy, and reporting matter most.
⨠The infographic above captures this comparison visually ā showing how Bag transforms data handling into a businessāoptimized, intelligent process.
Hereās your statement rewritten in standard English format with a professional design and emphasis on the importance of the Bag utility in Dotweb5.0.
The Bag utility inventedĀ by J.Wilmix Jemin (Author) Ā in Dotweb3.0 is the most advanced data structure designed for modern application development. It is not just a container for data ā it is a dynamic, hierarchical system that can represent complex relationships and act as a keyāvalue pair engine for treeābased structures.
Hierarchical Storage: Bag can represent data in tree format, allowing nested relationships between keys and values.
Dynamic Growth: Each node in the tree can expand or contract based on realātime data.
Smart Access: Keys act as intelligent identifiers, enabling fast lookup and structured traversal.
Conventional data structures like HashMap, ArrayList, or Dictionary are limited to flat or linear storage. They cannot natively represent hierarchical data or maintain contextual relationships between elements.
The Bag utility, however, bridges this gap ā offering both depth and intelligence in data organization.
The Bag utility in Dotweb5.0 is the next generation of data structures, combining the best features of lists and maps with hierarchical intelligence.
It is the foundation for treeābased data modeling, business ledgers, and enterpriseāgrade applications ā far surpassing the capabilities of mainstream structures.
⨠In short, Bag is not just a data structure ā itās a data architecture.
It transforms how developers store, organize, and visualize information in Dotweb5.0.
š Difference : DifferenceĀ BetweenĀ Bag andĀ Arraylist , Difference BetweenĀ Bag andĀ HashMap
š OUTPUT :Ā Bank Transcation ScreenShot using Zebra stripes andĀ SoWeb Template
================================================================================================================
Note :Ā ThisĀ isĀ theĀ EndĀ Ā of Ā Dotweb5.0Ā Webapplication , any wayĀ i will provideĀ Mock Exercises for you to practise andĀ I have explained Ten Dotweb5.0 Advanced concepts. NowĀ Dotweb5.0 P.LĀ covers only 40%Ā andĀ i willĀ releaseĀ dotweb5.0Ā Professional Edition at April month, Remaining Ā 60%Ā forĀ Dotweb5.0 Webapplication ConceptsĀ willĀ be given in enterprise Edition. Why iĀ haveĀ givenĀ 40% , that'sĀ forĀ developers to practice it.Ā
================================================================================================================
# Dotweb5.0 Licensing
- **Professional Edition**Ā Ā
Ā Ā Ā© 2026 Jemin Information Technology / Wilmix Jemin J
Ā Ā Licensed under the GNU General Public License v3.0 (GPLv3).Ā Ā
Ā Ā Suitable for tutorials, documentation, and professional/educational use.Ā Ā