#!/usr/local/bin/jconsole NB. J-WEB Some tools for generating HTML pages NB. Support for legacy args 9!:49 [ 1 NB. When using CGI scripts, the form "get" method sets the environment variable NB. QUERY_STRING to indicate arguments passed to the CGI script. NB. & separates field-value pairs; = separates each field and value. NB. query NB. Build a boxed table of field-value pairs from the CGI environment variable QUERY_STRING query =: 3 : 0 if. 0 -: r =. getenv y. do. '' else. > ((<;. _2) &. >) ((, & '=') &. >) < ;. _2 r,'&' end. ) NB. get_field NB. Return the value of a named field. get_field_helper =: 4 : ' > 1 { ((, 1 {. " 1 x.) i. < ,y.) { x.' NB. field-value pairs are passed to get_field by Currying get_field_helper. get_field =: (query 'QUERY_STRING') & get_field_helper NB. system NB. Perform Unix system call. NB. system will provide all sorts of security issues if its NB. arguments are not carefully checked. system =: 2 !: 0 NB. An HTML page is defined to consist of components header, y. (body) , trailer and footer. NB. page NB. Output html page page_helper =: 4 : 0 stdout > 0 { x. stdout y. stdout > 1 { x. stdout > 2 { x. exit 0 ) NB. J db of HTML page components NB. These components are provided in stub form below for testing purposes. header =: 0 : 0 Content-type: text/html