A comprehensive learning environment for understanding Apache Jelly through practical examples and documentation.
-
Java 11 or higher
# Check Java version java -version # If not installed, download from: # https://adoptium.net/ or https://www.oracle.com/java/technologies/downloads/
-
Maven 3.6 or higher
# Check Maven version mvn -version # If not installed: # macOS: brew install maven # Linux: sudo apt-get install maven # Windows: Download from https://maven.apache.org/download.cgi
-
Clone the repository
git clone https://github.com/RaikaSurendra/whatJelly.git cd whatJelly -
Compile the project
mvn clean compile
This will download all dependencies (Apache Jelly, JEXL, etc.) and compile the Java sources.
-
Run your first example
# Make the script executable (Unix/Mac) chmod +x run-example.sh # Run hello world example ./run-example.sh 01-hello-world
# Run all examples
./run-example.sh all
# Run specific example
./run-example.sh 02-variables
./run-example.sh 04-loops
# Run practical examples
./run-example.sh code-generator
./run-example.sh sql-generator
# Run with Maven directly
mvn exec:java -Dexec.mainClass="com.learning.jelly.JellyRunner" \
-Dexec.args="examples/01-hello-world.jelly"Apache Jelly is a Java and XML-based scripting and processing engine. It's a tool for turning XML into executable code. Jelly combines the power of:
- XML syntax - for structure and readability
- Java - for logic and execution
- Tag libraries - reusable components
- Written in XML format (typically
.jellyfiles) - Consist of tags from various tag libraries
- Execute dynamically at runtime
Jelly provides several built-in tag libraries:
- core (
jelly:core) - Basic control flow, variables, loops - xml - XML manipulation
- log - Logging functionality
- define - Create custom tags
- bean - JavaBean manipulation
- sql - Database operations
- http - HTTP requests
- jms - Message queuing
- The execution environment for Jelly scripts
- Stores variables and their values
- Can be passed between scripts
- Set with
<j:set>tag - Referenced using
${variableName}syntax (JEXL expressions) - Scoped within the JellyContext
- Parse - XML is parsed into a Jelly script tree
- Execute - Tags are executed in order
- Output - Results are written to an XMLOutput stream
- Code Generation - Generate Java/SQL/HTML from templates
- Build Tools - Maven uses Jelly for plugin scripts
- XML Transformation - More flexible than XSLT
- Testing - Dynamic test generation
- Configuration - Dynamic configuration files
whatJelly/
├── 📖 Documentation
│ ├── README.md - This file
│ ├── QUICKSTART.md - Quick setup guide
│ ├── TUTORIAL.md - Comprehensive tutorial
│ └── CONCEPTS.md - Deep dive into architecture
│
├── 📁 examples/ - Basic examples (01-10)
│ └── practical/ - Real-world examples
│
├── 🎓 advanced/ - Advanced concepts and patterns
│ ├── README.md - Advanced examples guide
│ ├── nested-contexts.jelly
│ ├── script-library.jelly
│ ├── data-driven-generation.jelly
│ ├── dynamic-script-composition.jelly
│ ├── ADVANCED_PATTERNS.md - Design patterns
│ ├── PERFORMANCE.md - Optimization guide
│ └── DEBUGGING.md - Debugging strategies
│
├── 🌐 jellyWebApp/ - Full-stack web application
│ ├── README.md - Web application guide
│ ├── DOCKER.md - Docker deployment
│ ├── TAG_LIBRARY_EXPLAINED.md - Tag library architecture
│ └── CHAPTERS.md - Step-by-step tutorial
│
└── 📁 src/main/java/ - Java utilities
After learning the basics, explore our complete servlet-based web application that demonstrates real-world Jelly usage:
📂 Location: jellyWebApp/
Features:
- ✅ Servlet Integration - JellyServlet handling .jelly template requests
- ✅ Custom SQL Tags -
<app:sqlQuery>,<app:sqlUpdate>,<app:sqlExecute> - ✅ H2 Database - In-memory database with sample data
- ✅ Interactive D3.js Visualizations - Architecture diagrams showing:
- Request lifecycle (browser → response)
- TagLibrary & TagSupport class hierarchy
- Tag processing flow with code examples
- ✅ Docker Support - Multi-stage builds, docker-compose
- ✅ Multiple Pages - Users, Products, Dashboard, Admin, Architecture
- ✅ Enhanced Tooltips - Hover over any element for detailed technical info
- ✅ Chapter-Based Tutorial - Learn by building
Quick Start:
cd jellyWebApp
# Run with Docker (recommended)
docker-compose up -d
# Or run locally
./run.sh
# Access at http://localhost:8080Why This Matters: The web app bridges the gap between learning examples and production code. You'll see:
- How to integrate Jelly with Java servlets
- How to create custom tag libraries
- How tags are registered and looked up
- Real database integration patterns
- Professional D3.js visualizations
Documentation:
- 📖 Full README - Setup and usage
- 🐳 Docker Guide - Deployment details
- 🏷️ Tag Library Explained - Architecture deep-dive
- 📚 Chapter Tutorial - Step-by-step learning
- Read
QUICKSTART.mdfor setup - Run basic examples (01-10)
- Study
TUTORIAL.md
- Try practical examples (code-generator, sql-generator)
- Read
CONCEPTS.mdfor deeper understanding - Experiment with modifications
- ⭐ Explore
jellyWebApp/for real-world application
- Explore
advanced/folder - Study
ADVANCED_PATTERNS.md - Read
PERFORMANCE.mdandDEBUGGING.md - ⭐ Study jellyWebApp architecture visualizations
- Build complex applications
# Using Maven
mvn compile exec:java -Dexec.mainClass="JellyRunner" -Dexec.args="script.jelly"
# Programmatically in Java
JellyContext context = new JellyContext();
XMLOutput output = XMLOutput.createXMLOutput(System.out);
context.runScript("script.jelly", output);Ready for more? Check out the advanced/ folder:
- Nested Contexts - Master variable scoping
- Script Composition - Build modular scripts
- Data-Driven Generation - Complex code generation
- Performance Optimization - Speed and memory tuning
- Debugging Techniques - Troubleshoot like a pro
See advanced/README.md for details.