PSP
As of version 0.2, Pike ScriptRunner can be used to run Pike Server Pages (PSP) files. PSP is similar to JSP in that it allows you to mix code and content on the same page. The PSP markup format is:Expressions
<%= someexpression %> gives you some expression cast as a string.
for example:
<%= random(100) %> is a positive random number less than 100.
The RequestID object is available as "request" in expressions, as is "out".
See the scriptlets section for more information.ScriptletsPSP allows code to be inserted into the page as part of the request handling method. This code is called a "Scriptlet".
<% somepikecode %> inserts some pike code fragments in page (aka scriptlet)
for example
<%
for(int a = 99; a > 0; a--)
{
out+= (a + " bottles of beer on the wall.n<p>");
}
%>
The RequestID object is available as "request".The object "out" is available and is a String.Buffer. All of your output should be + or add()ed to this object.return doesn't play a role here; don't use it!blocks of non-psp markup are considered a block, so you can do this:
<% if(id->variables->somevar) %>
all this
appears if somevar is present and non-zero.
<% else %>
all of this appears otherwise, until we hit another <% %> (ie this shows up
regardless) block.
note that you can use {} in these cases to force the situation, as all text blocks get converted automatically to output().DeclarationsPSP allows you to define methods and include page global objects and variables that remain after the request has finished. These items may be defined using the declaration syntax:
this code will be placed inside the servicing object, but outside of the
page servicing method, so you can use this "directive" tag to define
additional methods, perform inherits and includes, and so forth.DirectivesDirectives allow you to perform certain operations that may be important to the functioning of your page. Currently, only the include directive is implimented.
this will include some other file into the current file, and will be parsed as a psp fragment. currently, absolute paths are properly supported, relative to the document root. relative paths have undefined behavior at this point. more work needs to be done on this.
Powered by PikeWiki2
|
|