Apache ASP
Server pages
- Server pages embed active code in HTML pages
- Examples:
- Microsoft's ASP
- Apache ASP
- Perl Template module
- Java Server Pages
- Apache ASP has Perl as preferred scripting language
Embedding code
- Expressions can be embedded and are evaluated at runtime
- Typical syntax for expression embedding
<%= expression =%>
- Code can be embedded and is typically compiled
or interpreted at runtime
<% code %>
- The code between start and end tags can span multiple lines
-
Simple example
<html>
<body>
For loop incrementing font size: <p>
<% for(1..5) { %>
<!-- iterated html text -->
<font size="<%=$_%>" > Size = <%=$_%> </f
ont> <br>
<% } %>
</body>
</html>
Name.pl as an ASP
#!/usr/local/bin/perl5 asp
<!--#include file=header.inc-->
<h1> Hobby </h1>
<% $name = $Request->Form('name');
$Session->{name} = $name;
%>
<p>
Hi <%= $name =%>, please select a hobby
<form action="hobbies.pl">
<input
<select name="hobby">
<option value="tennis">tennis
<option value="chess">chess
<option value="eating">eating
<option value="dancing">dancing
</select>
<input type="submit">
</form><hr>
</body></html>
Jan Newmarch (http://pandonia.canberra.edu.au)
jan@ise.canberra.edu.au
Last modified: Tue Aug 22 15:30:36 EST 2000
Copyright ©Jan Newmarch