blob: 30f8bcec129d24f0079c1078a10122f7223f2009 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>dispatch_1</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#1F00FF" ALINK="#FF0000" VLINK="#9900DD">
<A NAME="top">
<A NAME="file1">
<H1>dispatch_1.ws3</H1>
<PRE>
<I><FONT COLOR="#B22222"># register the websh command &quot;pricelist&quot;
</FONT></I>web::command pricelist {
<I><FONT COLOR="#B22222"># web::put sends string to the default output channel
</FONT></I> <I><FONT COLOR="#B22222"># (stdout in the CGI case), including HTTP headers
</FONT></I> web::put {&lt;tt&gt;&lt;h2&gt;price <B><FONT COLOR="#A020F0">list</FONT></B>&lt;/h2&gt;&lt;/tt&gt;}
<I><FONT COLOR="#B22222"># web::cmdurl produces a URL with querystring. In this case,
</FONT></I> <I><FONT COLOR="#B22222"># we just want to switch back to &quot;default&quot;, that's why we omit
</FONT></I> <I><FONT COLOR="#B22222"># an explicit command name and just use &quot;&quot;
</FONT></I> web::put <B><FONT COLOR="#BC8F8F">&quot;&lt;a href=\&quot;[web::cmdurl &quot;</FONT></B><B><FONT COLOR="#BC8F8F">&quot;]\&quot;&gt;back&lt;/a&gt;&quot;</FONT></B>
}
<I><FONT COLOR="#B22222"># register the websh command &quot;default&quot;
</FONT></I>web::command default {
<I><FONT COLOR="#B22222"># welcome note
</FONT></I> web::put {&lt;tt&gt;&lt;h2&gt;hello, customer&lt;/h2&gt;&lt;/tt&gt;}
<I><FONT COLOR="#B22222"># link to an other HTML page of this application, the price list.
</FONT></I> <I><FONT COLOR="#B22222"># We generate the URL using web::cmdurl and specify the command
</FONT></I> <I><FONT COLOR="#B22222"># to be used: it is called pricelist and has been defined above.
</FONT></I> web::put <B><FONT COLOR="#BC8F8F">&quot;&lt;a href=\&quot;[web::cmdurl pricelist]\&quot;&gt;price list&lt;/a&gt;&quot;</FONT></B>
}
<I><FONT COLOR="#B22222"># do the command dispatching
</FONT></I><I><FONT COLOR="#B22222"># this will switch into &quot;pricelist&quot; or &quot;default&quot; depending on
</FONT></I><I><FONT COLOR="#B22222"># the query_string
</FONT></I>web::dispatch
</PRE>
<HR>
<ADDRESS>Generated by <A HREF="http://www.iki.fi/~mtr/genscript/">GNU enscript 1.6.3</A>.</ADDRESS>
</BODY>
</HTML>