120 likes | 317 Views
PHOBOS Javascript Engine. By Daniel Reeves. What is Phobos?. Lightweight application framework for Java Used by NetBeans Supports multiple scripting languages Focuses mainly on JavaScript Can be put in any servlet container. Architecture Overview. Why Use Phobos?.
E N D
PHOBOS Javascript Engine By Daniel Reeves
What is Phobos? • Lightweight application framework for Java • Used by NetBeans • Supports multiple scripting languages • Focuses mainly on JavaScript • Can be put in any servlet container
Why Use Phobos? • Universal to most scripting languages • Auto generates a skeletal web application for the user to create • Users can add a number of different prebuilt AJAX or javascript models such as jMaki and Dojo • Easy to use URL mapping • Multilingual- JSR-223-based
Setting up Phobos • Netbeans module Addon • Uses predefined libraries and setups to initialize the web application structure. • Defines any additional class structure elements for the web application (CSS files)
How it Works • At the first page request, index.js redirects and creates the controller for the application. • The controller defines all the methods within the controller’s javaScript file • The controller then renders the web application through the show() method • Show() renders the embedded Javascript file in the application, which defines what the user sees. • The application rerenders when POST is called.
Index.js • library.httpserver.sendRedirect(library.httpserver.makeUrl("/list/show"));
Show() • library.view.render({view: "list.ejs", layout: "layout.ejs"});
Using AJAX with Phobos • Phobos can easily do AJAX xhr requests • Example: AJAX List
Resources • Project Phobos- https://phobos.dev.java.net/