Home > Articles > Web Services

  • Print
  • + Share This
Like this article? We recommend

Multiple Pages in Water

In a page-oriented template language like ASP or JSP, there is a separate file for every page that will be 'called' from a URL.

In Water, you can have multiple objects or methods defined in a single file. Loading the following Water file named "the_date.h2o" will create two variables that can be accessed with a URL:

<set the_date = <HTML> Today is <datetime.today/> </HTML> />
<set my_name = "Mike Plusch" />

To define these two variables on the water.waterlang.org server, you would add the following line to the server initialization file, "init.h2o":

<file "first_program.h2o"/>.<load/>

The following URL's would retrieve the values of the defined variables:

http://water.waterlang.org/the_date
http://water.waterlang.org/my_name

The URL is simply a Water expression that is executed on the server. You could think of the URL as a command-line interface to the IDE. For example, the following URL would produce the same result:

http://water.waterlang.org/<HTML>Today is <datetime.today/> </HTML>
  • + Share This
  • 🔖 Save To Your Account