Tutorial
proxies, and webbrowsers won’t have to reload the JavaScript code on each. pageview. We will publish the tutorial JavaScript under ‘/tutorial.js. … – \”>
More PDF Content
Tutorial
Page 1
Tutorial August 28, 2007 Contents 1 ParenScript Tutorial 1 2 Setting up the ParenScript environment 1 3 A simple embedded example 2 4 Adding an inline ParenScript 2 5 Generating a JavaScript file 4 6 A ParenScript slideshow 5 7 Customizing the slideshow 10 1 ParenScript Tutorial This chapter is a short introductory tutorial to ParenScript. It hopefully will give you an idea how ParenScript can be used in a Lisp web application. 2 Setting up the ParenScript environment In this tutorial, we will use the Portable Allegroserve webserver to serve the tutorial web application. We use the ASDF system to load both Allegroserve and ParenScript. I assume you have installed and downloaded Allegroserve and Parenscript, and know how to setup the central registry for ASDF. (asdf:oos ’asdf:load-op :aserve) ; … lots of compiler output … (asdf:oos ’asdf:load-op :parenscript) ; … lots of compiler output … The tutorial will be placed in its own package, which we first have to define. 1
Page 2
(defpackage :js-tutorial (:use :common-lisp :net.aserve :net.html.generator :parenscript)) (in-package :js-tutorial) The next command starts the webserver on the port 8080. (start :port 8080) We are now ready to generate the first JavaScript-enabled webpages using ParenScript. 3 A simple embedded example The first document we will generate is a simple HTML document, which fea- tures a single hyperlink. When clicking the hyperlink, a JavaScript handler opens a popup alert window with the string “Hello world”. To facilitate the development, we will factor out the HTML generation to a separate function, and setup a handler for the url “/tutorial1”, which will generate HTTP headers and call the function TUTORIAL1. At first, our function does nothing. (defun tutorial1 (req ent) (declare (ignore req ent)) nil) (publish :path “/tutorial1″ :content-type “text/html; charset=ISO-8859-1″ :function (lambda (req ent) (with-http-response (req ent) (with-http-body (req ent) (tutorial1 req ent)))))
PDF files Related to this topic:
- Tutorial proxies, and webbrowsers won’t have to reload the JavaScript code...
- Simple AJAX Tutorial by Stephan Spies Aug 1, 2006 … This is a very simple tutorial...
- Simple AJAX Tutorial by Stephan Spies Aug 1, 2006 … This is a very simple tutorial...
- The Basics of JavaScript’s JavaScript Tutorial at Webdeveloper.com. This tutorial goes over JavaScript basics...
- Create HTML Forms – a Tutorial Create HTML Forms. A Tutorial. by. William Bontrager. Programmer. and....
Processing your request, Please wait....