Arbotext Publishing Engine Programmer's Guide (《Arbortext Publishing Engine 程序员指南》) > The Arbortext Publishing Engine Sub-Process > Writing Arbortext PE 应用程序s in JavaScript
  
Writing Arbortext PE 应用程序s in JavaScript
An Arbortext Publishing Engine JavaScript application is a subroutine function which takes two parameters, a Java request object and a Java response object. The Arbortext PE 子进程 uses the Rhino JavaScript package to make Java objects accessible to JavaScript programs. Essentially, this means that JavasScript Arbortext Publishing Engine applications run in the same programming environment as Arbortext Publishing Engine Java applications. For more information on making Java available to JavaScript using LiveConnect, refer to the Calling Java from JavaSctipt section of the Programmer's Reference.
The Arbortext PE Request Manager processes requests for Arbortext Publishing Engine JavaScript applications by passing requests with the f query parameter with the value javascript to the request function com.arbortext.e3.FunctionJavascript. The request function allocates an Arbortext PE 子进程 and passes the request to the Arbortext PE 应用程序 Context (described in The Arbortext PE 子进程 Application Context). The Arbortext PE 应用程序 Context creates the request and response objects. Then, it directs the Arbortext PE 子进程 JavaScript interpreter to evaluate the function specified in the function parameter of the HTTP request. The function must be defined in a .js file in a custom\init directory or in a .js file in custom\scripts which is loaded from custom\init. The returned value for the JavaScript function is ignored because the data must be transmitted to the client in the response object.
A JavaScript Arbortext PE 应用程序 can access information about the request and set information to be returned as part of the response using the same interface as an Arbortext PE 应用程序 written in Java. Unlike a Java Arbortext PE 应用程序, a JavaScript Arbortext PE 应用程序 has no initialization or termination component.