blob: b09fbf3efbb569d6d35446eac1b86912df0e3c1c [file] [log] [blame]
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Websh - Welcome</title>
<script language="JavaScript" src="buttons.js"></script>
<link href="websh.css" rel="styleSheet" type="text/css">
<meta name="description" content="Websh - the rapid development environment to build powerful web applications.">
<META NAME="keywords" CONTENT="websh, Websh, e-commerce, web application, apache, perl, php, asp, cold fusion">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0"
bgcolor="#ffffff" link="#006699" alink="red" vlink="#006699">
<map name="grafik_navi">
<area href="mailto:websh-dev@tcl.apache.org" coords="94,2,154,26" shape="rect">
<area href="./" coords="4,2,64,26" shape="rect">
<area href="contact.html" coords="184,2,244,26" shape="rect">
</map>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="76">
<tr valign="top">
<td width="500" bgcolor="#006699"><img height="50" width="300" src="images/grafik_navi_home.gif" alt="" border="0" usemap="#grafik_navi"><img height="50" width="200" src="images/grafik_index.gif" alt=""></td>
<td><img height="50" width="270" src="images/logo.gif" alt="Websh"></td>
<td width="5000" bgcolor="#000000">&nbsp;</td>
</tr>
<tr>
<td width="500">
<table border="0" cellpadding="0" cellspacing="0" width="500" height="40">
<tr bgcolor="#006699">
<td><a href="/websh/product.html" onmouseover="swap('prod','b_prod_b')" onmouseout="swap('prod','b_prod_a')"><img height="20" width="120" src="/websh/buttons/b_prod_a.gif" name="prod" border="0" alt="product description"></a></td>
<td width="100"><br></td>
<td><a href="/websh/support.html" onmouseover="swap('supp','b_supp_b')" onmouseout="swap('supp','b_supp_a')"><img height="20" width="70" src="/websh/buttons/b_supp_a.gif" name="supp" border="0" alt="support"></a></td>
<td><a href="/websh/resources.html" onmouseover="swap('ress','b_ress_b')" onmouseout="swap('ress','b_ress_a')"><img height="20" width="110" src="/websh/buttons/b_ress_a.gif" name="ress" border="0" alt="resources and links"></a></td>
<td><a href="/websh/download.html" onmouseover="swap('down','b_down_b')" onmouseout="swap('down','b_down_a')"><img height="20" width="100" src="/websh/buttons/b_down_a.gif" name="down" border="0" alt="download"></a></td>
</tr>
<tr height="20">
<td width="120" height="20"><img height="20" width="120" src="images/title.gif"></td>
<td width="100" height="20"><img height="20" width="100" src="buttons/b_docu_c.gif"></td>
<td width="70" height="20"><img height="20" width="70" src="images/title.gif"></td>
<td width="110" height="20"><img height="20" width="110" src="images/title.gif"></td>
<td width="100" height="20"><img height="20" width="100" src="images/title.gif"></td>
</tr>
</table>
</td>
<td><img height="40" width="270" src="images/logo_strich.gif"></td>
</tr>
</table>
<div style="padding: 15px; color:#fff; background-color: #069; font-weight: bold; width: 730px; margin: 5px;">
We are sorry but we discontinued Websh support and development for lack of resources.
Also the discussion mailing list was closed, so if you're interested in taking up this subproject within the Apache Tcl project to bring it back into life please contact private@tcl.apache.org
</div>
<table border="0" cellpadding="0" cellspacing="0" width="770">
<tr height="30">
<td width="10" valign="top"></td>
<td width="150" height="30"></td>
<td width="610" height="30">
<h1>Websh example code</h1>
</td>
</tr>
<tr valign="top">
<td width="10"><img height="1" border="0" width="10" src="images/stuntFFFFFF001010.gif"></td>
<td width="150">
<table border="0" cellpadding="0" cellspacing="0" width="141">
<tr valign="top">
<td width="10"><img height="11" width="10" src="images/pfeil.gif"></td>
<td class=nav>
<a href="/websh/docu.html"><b>documentation</b></a><br>
<br></td></tr>
<tr valign="top">
<td width="10"><img height="11" width="10" src="images/pfeil.gif"></td>
<td class=nav>
<a href="/websh/whitepaper.html"><b>white paper</b></a><br>
<br></td></tr>
<tr valign="top">
<td width="10"><img height="11" width="10" src="images/pfeil.gif"></td>
<td class=nav>
<a href="/websh/quickref.html"><b>quick reference</b></a><br>
<br></td></tr>
<tr valign="top">
<td width="10"><img height="11" width="10" src="images/pfeil.gif"></td>
<td class=nav>
<b>examples</b><br>
<br></td></tr>
</table>
</td>
<td width="610">
This section presents a selection of sample Websh applications.
All applications are described in detail on this page and come with
richly documented source code. For simplicity, they are all-in-one
files. Plus, they are on-line and ready to use. For each application
discussed below, you will find the corresponding links which present
the styled code and the plain text version for download.
<br>
<a name="toc"><a href="#toc"><h1>1 Table of Contents</h1></a>
<br>1&nbsp;<a href="#toc"><b>Table of Contents</b></a><br>
<br>2&nbsp;<a href="#13"><b>hello world</b></a><br>
<br>3&nbsp;<a href="#26"><b>command dispatching</b></a><br>
<br>4&nbsp;<a href="#41"><b>image</b></a><br>
<br>5&nbsp;<a href="#51"><b>confirmation form</b></a><br>
<br>6&nbsp;<a href="#62"><b>checkbox form</b></a><br>
<br>7&nbsp;<a href="#72"><b>upload file</b></a><br>
<br>8&nbsp;<a href="#83"><b>sessions</b></a><br>
<br>9&nbsp;<a href="#103"><b>cookie</b></a><br>
<br>10&nbsp;<a href="#111"><b>memory game</b></a><br>
<br><br>
<a name="13"><a href="#toc"><h1>2 hello world</h1></a>
In order to get a first impression, let's look at a simple example.
All it does is printing &quot;Hello, world&quot;. It consists of one websh
command, <tt>web::put</tt>. Basically, <tt>web::put</tt> works like Tcl's
<tt>puts</tt> command. In addition to printing the text, it does send HTTP
headers when invoked for the first time.<br>
<a href="examples/helloworld.html" onclick="javascript:window.open('','source','width=500,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');" target="source")>source</a>
|
<a href="examples/helloworld_ws3.txt">download</a>
<a name="26"><a href="#toc"><h1>3 command dispatching</h1></a>
Now, let's look at one of the main features of websh: the command
dispatching. This allows you to produce all your HTML page from one
and the same source code. This example produces two HTML pages, the
&quot;greetings&quot; page and a &quot;price list&quot; page (even though, for simplicity,
the price list is empty). It uses <tt>web::dispatch</tt> to switch into one
of these pages, and <tt>web::cmdurl</tt> to produce URLs pointing to each
of these pages.<br>
<a href="examples/dispatch_1.html" onclick="javascript:window.open('','source','width=500,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');" target="source")>source</a>
|
<a href="examples/dispatch_1_ws3.txt">download</a>
<a name="41"><a href="#toc"><h1>4 image</h1></a>
This example demonstrates how to return an image instead of the
normal &quot;text/html&quot; mime type.<br>
<a href="examples/image.html" onclick="javascript:window.open('','source','width=500,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');" target="source")>source</a>
|
<a href="examples/image_ws3.txt">download</a>
<a name="51"><a href="#toc"><h1>5 confirmation form</h1></a>
This example demonstrates a confirmation form. The user is promted a form to
enter, say, order information. The information is validated and, if sucessfull,
an e-mail is sent back to the user.<br>
<a href="examples/emailform.html" onclick="javascript:window.open('','source','width=500,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');" target="source")>source</a>
|
<a href="examples/emailform_ws3.txt">download</a>
<a name="62"><a href="#toc"><h1>6 checkbox form</h1></a>
This example demonstrates how to handle checkboxes. The user is promted a form to
select checkboxes, to display date informations. <br>
<a href="examples/checkbox.html" onclick="javascript:window.open('','source','width=500,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');" target="source")>source</a>
|
<a href="examples/checkbox_ws3.txt">download</a>
<a name="72"><a href="#toc"><h1>7 upload file</h1></a>
This example demonstrates a upload form. The user is promted a form to
enter, local file. The file is validated and, if sucessfull,
the server shows in a confirmation the uploaded data back to the user.<br>
<a href="examples/upload.html" onclick="javascript:window.open('','source','width=500,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');" target="source")>source</a>
|
<a href="examples/upload_ws3.txt">download</a>
<a name="83"><a href="#toc"><h1>8 sessions</h1></a>
This example demonstrates file-based server-side sessions. Suppose a
customer visits this application for the first time. The application
creates a new session file using <tt>state::init</tt> and stores the
session id in the query string. From now on, <tt>state::init</tt> will know
the session id and re-load the session context - the application
&quot;remembers&quot; the customers settings across multiple HTTP requests using
a session id embedded in all generated URLs. For simplicity, we do not
add shopping items to a shopping cart in this example, but just save
the data of two forms which are presented to the customer. This
involves a little bit of form handling, and this example also
demonstrates error handling in case of unexpected input. But let's
look at the example.<br>
<a href="examples/session_form.html" onclick="javascript:window.open('','source','width=500,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');" target="source")>source</a>
|
<a href="examples/session_form_ws3.txt">download</a>
<a name="103"><a href="#toc"><h1>9 cookie</h1></a>
This example demonstrates how to use cookies. It is very similar to the
session example above.<br>
<a href="examples/cookie.html" onclick="javascript:window.open('','source','width=500,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');" target="source")>source</a> |
<a href="examples/cookie_ws3.txt">download</a>
<a name="111"><a href="#toc"><h1>10 memory game</h1></a>
This is a more complex example. You know the game &quot;memory&quot;, right ?
The goal is to find matching pictures with the least possible number
of tries. The application keeps track of the number of your tries for
a given game and level and compares it with the &quot;hall of fame&quot;. This
version does not use sessions except for the &quot;hall of fame&quot;, and
stores all information in the URL, which makes the output a little bit
bulky. Have fun.<br>
<a href="examples/memory.html" onclick="javascript:window.open('','source','width=500,height=400,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');" target="source")>source</a>
|
<a href="examples/memory_ws3.txt">download</a>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="770" height="45">
<tr valign="top">
<td colspan="2">
<hr noshade size="1">
</td>
</tr>
<tr valign="top">
<td width="10"></td>
<td width="760">
<a href="product.html">description</a>&nbsp;|&nbsp;<a href="docu.html">documentation</a>&nbsp;|&nbsp;<a href="support.html">support</a>&nbsp;|&nbsp;<a href="resources.html">resources</a>&nbsp;|&nbsp;<a href="download.html">download</a>&nbsp;|&nbsp;<a href="credits.html">credits</a>&nbsp;|&nbsp;<a href="copyright.html">copyright</a>
</td></tr>
<tr valign="top">
<td colspan="2">
<hr noshade size="1">
</td>
</tr>
<tr valign="top">
<td width="10"></td>
<td width="760">
<span class="klein"><b>&copy; Websh - an <a href="http://tcl.apache.org">Apache Tcl</a> project - part of the <a href="http://www.apache.org/">Apache Software Foundation</a></b></span></td>
</tr>
</table>
</body>
</html>