NB. J-WEB Some tools for generating HTML pages 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 environment variable QUERY_STRING query =: 3 : 0 if. 0 -: r =. getenv y. do. '' else. > ((<;. _2) &. >) ((, & '=') &. >) < ;. _2 r,'&' end. ) NB. Return value of 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. Perform Unix system call. system =: 2 !: 0 NB. An HTML page is defined to consist components of a header, y. (body) , trailer and footer. 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 header =: 0 : 0 Content-type: text/html