;; this servlet takes in four parameters
;; and just uses them to make a simple page
;; containing the four values in a list
(servlet (name age favcol zzz)
(list name age favcol zzz))
demo2.servlet
;; demo2 -- getting the values using a form...
(servlet (name age)
(case name
((#null)
{add ?name=NAME&age=AGE to the URL and return}
)
(("Tim")
{Hi Tim, que pasa?})
(else
{Hello [name], you are [age] years old}
)
)
)
demo3.servlet
;; this servlet shows how to write a password protected page
(servlet (pw)
(case pw
((#null)
{})
(("diane")
{
Great! you got it. The answer to the quiz is
})
(else
{Wrong password! })))
demo4.servlet
;; this servlet shows how to use values sent to the servlet
;; call it as follows:
;; demo4.servlet?a=3&name=tim&c=23
;; the other parameters will have the value #null
(servlet (a b c name age)
{the parameters were
a=[a], b=[b], c=[c],
your name is [name] you are [age] years old
}
)
demo5.servlet
;; here is another example of a servlet that inserts values
;; you give it, into a page
(servlet (noun verb adj1 adj2 noun2)
{One day the [noun] set out for a walk.
It [verb] a [adj1] [noun2] and was
[adj2]
}
)
demo6.servlet
;; This shows how to use the input, textarea, radio, and checkbox form elements
;; notice the funny way of writing textarea. This is need to have it work
;; correctly with the Umethod....
(servlet (a b c d e)
(if (equal? a #null)
{
}
{You entered [a] [b] [c] [d] [e]}
)
)
demo7.servlet
;; this shows how to fold several web pages into a single servlet
(servlet (page)
(case page
((#null)
{})
(("first") {This is the very first page...})
(("second" "preface") {We haven't written these pages yet})
(("copyright") {Tim Hickey Copyright 2002 All Rights Reserved})
(else {How did you get here??? You must be devious!})
)
)
demo8.servlet
;; this shows how to send email using a servlet
(servlet (name email comment)
(case name
((#null) {
})
(else
(send-mail request
"tjhickey@brandeis.edu" ;to
email ;from
"Someone visited your page" ;subject
comment ;message
)
(send-mail request
email
"cs2a@cs.brandeis.edu"
"thanks for the comments"
{email:[email] and su nombre es [name] and you said=[comment]} )
{Thanks [name] for your comment, it has been sent to the author}
) ; close else
) ; close case
) ; close servlet
demo9.servlet
;; this illustrates the concept of abstraction
;; It is a way of creating "new tags"
(servlet ()
(define (ptag file title blurb cost)
{