JHP

JHP: J Hypertext Processor

JHP is a J based engine to run server-side web applications and create dynamic web content. Syntax is similar to PHP or ASP. JHP can run on any platform and web server.

Browse [WWW] JHP at [WWW] olegykj.sourceforge.net to see it in action live on that server. The above link also contains documentation. (Note: those pages require that javascript be enabled in the browser.)

See also: examples in [JSvnAddons]examples folder in SVN; change [JSvnAddons]history.

Examples

The following source code is an example of JHP.

<% ContentType'text/html' %>
<html><head>
  <link rel="stylesheet" type="text/css" href="style.css">
</head><body>

<h2>Random Test</h2>

<p>Time is <%= 6!:0 '' %></p>

<% 9!:1 >.{:6!:0 '' %>

<p>Random array with seed <%= 9!:0'' %></p>

<pre><%= ":3 4 ?@$ 100 %></pre>

</body></html>

Syntax

JHP syntax is similar to ASP or PHP. Plain HTML is entered as is. J code is introduced by matching pairs of percent brackets <% ... %>. As a result, plain text is sent to the server as is and the J code is executed.

Any output in a particular piece of code is sent in between the surrounding plain HTML. Two verbs are used for output: print and println, the latter adding a LF to the end. These verbs format arguments as string.

<%= ... %> is a short cut for <%print ... %>. The content between such brackes cannot contain new lines, whereas the regular brackets permit them, as in J script.

It is required that the first line of the page specifies the MIME format, such as

<% ContentType'text/html' %>
<html><head>
  ...

It is possible to produce any format output, such as XML, CSV, images, audio, etc. However, you must pay attention to observe spaces or absence thereof between the percent brackets.

JHP Configuration steps for Microsoft IIS 7.0

See Also

JWebServer

last edited 2008-01-03 06:49:59 by OlegKobchenko