Differences between revisions 2 and 15 (spanning 13 versions)
Revision 2 as of 2009-01-02 17:38:51
Size: 309
Comment:
Revision 15 as of 2013-12-24 13:05:51
Size: 2430
Editor: anonymous
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Once the MildServer is running on your machine (see MildServer/GettingStarted), you should be able to direct your browser to http://localhost:8080 and see the front page: ## page was renamed from MildServer/Samples/Index
= MildServer Samples: The Index Page =

<<Navigation(siblings)>>
<<BR>>

The front page of the MildServer (which you can see by directing your browser to http://localhost:8080) is implemented by the file called ''index.dyalog'' in the Demo folder. It looks like this:

{{{
:Class Index : MildPage

    :Include #.HTMLInput

    ∇ Render req;html;links;hdr
      :Access Public
     
      hdr←'h2'Enclose'Welcome to MildServer'
      html←#.Files.GetText req.Server.Root,'welcome.txt'
      req.Return hdr,'p' Enclose html
    ∇

:EndClass
}}}

The front page is essentially a static page - it is not interactive and does not change, so it could have been implemented using a simple HTML text file. It is only implemented as a scripted page in order to provide a very simple example to discuss.

The HTMLInput class is included so that we can use the {{{Enclose}}} function to wrap the header in an 'h2' (header level 2) tag, and the body text in a 'p' (paragraph) tag. The body text itself is retrieved from the file ''welcome.txt''. Finally, the HTML is passed to req.Return, producing the following output:
Line 5: Line 31:
The front page is implemented by a file in the Demo folder, called index.dyalog. (more to come) The HTML returned is the following (the ''html'' and ''body'' tags and the ''head'' section are added by the ''Wrap'' method in the class defined by ''Code\!DemoServer.dyalog'' Class):
{{{
<html><head>

<title>Demo Server</title>
<link href="/Styles/Style.css" rel="stylesheet" type="text/css">
</head>
<body><h2>Welcome to MildServer</h2>
<p><i>Anyone who can write an APL function should be able
to make it available on the Internet.</i><br><br>
This is the goal of the
<a href="http://aplwiki.com/MildServer">MildServer Project</a>.
You can read more about the project and download source code from the
<a href="http://aplwiki.com">APL Wiki</a>.<br><br>

Click on one of the following links to run MildServer sample pages:
<ul>
  <li><a href="/reverse?Name=Beethoven">Roll over Beethoven!</a></li>
  <li><a href="/mmind/MMind.dyalog?">Animal Mastermind</a></li>
  <li><a href="/linreg">Linear Regression</a></li>
  <li><a href="Admin/httprequest">HTTPRequest Content Demo</a></li>
  <li><a href="Admin/sessioninfo">SimpleSession Information Demo</a></li>
</ul>
</p>
</body></html>
}}}

<<Navigation(siblings)>>
Return to the main MildServer page.
<<BR>><<BR>>

MildServer Samples: The Index Page


The front page of the MildServer (which you can see by directing your browser to http://localhost:8080) is implemented by the file called index.dyalog in the Demo folder. It looks like this:

:Class Index : MildPage

    :Include #.HTMLInput

    ∇ Render req;html;links;hdr
      :Access Public
     
      hdr←'h2'Enclose'Welcome to MildServer'
      html←#.Files.GetText req.Server.Root,'welcome.txt'
      req.Return hdr,'p' Enclose html

:EndClass

The front page is essentially a static page - it is not interactive and does not change, so it could have been implemented using a simple HTML text file. It is only implemented as a scripted page in order to provide a very simple example to discuss.

The HTMLInput class is included so that we can use the Enclose function to wrap the header in an 'h2' (header level 2) tag, and the body text in a 'p' (paragraph) tag. The body text itself is retrieved from the file welcome.txt. Finally, the HTML is passed to req.Return, producing the following output:

MildServerIndex.jpg

The HTML returned is the following (the html and body tags and the head section are added by the Wrap method in the class defined by Code\DemoServer.dyalog Class):

<html><head>

<title>Demo Server</title>
<link href="/Styles/Style.css" rel="stylesheet" type="text/css">
</head>
<body><h2>Welcome to MildServer</h2>
<p><i>Anyone who can write an APL function should be able 
to make it available on the Internet.</i><br><br>
This is the goal of the 
<a href="http://aplwiki.com/MildServer">MildServer Project</a>. 
You can read more about the project and download source code from the 
<a href="http://aplwiki.com">APL Wiki</a>.<br><br>

Click on one of the following links to run MildServer sample pages:
<ul>
  <li><a href="/reverse?Name=Beethoven">Roll over Beethoven!</a></li>
  <li><a href="/mmind/MMind.dyalog?">Animal Mastermind</a></li>
  <li><a href="/linreg">Linear Regression</a></li>
  <li><a href="Admin/httprequest">HTTPRequest Content Demo</a></li>
  <li><a href="Admin/sessioninfo">SimpleSession Information Demo</a></li>
</ul>
</p>
</body></html>

Return to the main MildServer page.

MiServer/Samples/Index (last edited 2013-12-24 13:06:06 by anonymous)