[ginseng-cvs] CVS ginseng/examples

wchunye wchunye at common-lisp.net
Sat Sep 11 16:10:46 UTC 2010


Update of /project/ginseng/cvsroot/ginseng/examples
In directory cl-net:/tmp/cvs-serv30329

Modified Files:
	examples.lisp 
Log Message:
add examples.lisp

--- /project/ginseng/cvsroot/ginseng/examples/examples.lisp	2010/09/11 15:53:52	1.1
+++ /project/ginseng/cvsroot/ginseng/examples/examples.lisp	2010/09/11 16:10:46	1.2
@@ -194,4 +194,41 @@
                      :value "OK"))
        ))))
 
+(defun http-add-two-numbers (&optional (next-action nil))
+  (invoke-next-action next-action :main #'add-two-numbers))
+(defun add-two-numbers ()
+  (let* ((first-number 0)
+         (form-id (dynamic-url
+                    (input-next-number first-number)))
+         (first-number-call-back-id (bindf  first-number :type 'integer))
+         )
+    (standard-page ()
+      (<:form :action form-id
+              (<:p "Please input the first number to add:"
+                   (<:input :type :text
+                            :name first-number-call-back-id
+                            ))
+              (<:p (<:input :type :submit
+                     :name "OK"
+                     :value "OK"))))))
+(defun input-next-number(first-number)
+  (let* ((second-number 0)
+         (form-id (dynamic-url
+                    (sum-of-the-two-numbers first-number second-number)))
+         (second-number-call-back-id (bindf  second-number :type 'integer))
+         )
+    (standard-page ()
+      (<:form :action form-id
+              (<:p (<:as-html "Add to " first-number  "."
+                              " Please input the second number:")
+                   (<:input :type :text
+                            :name second-number-call-back-id))
+              (<:p (<:input :type :submit
+                            :name "OK"
+                            :value "OK"))))))
+(defun sum-of-the-two-numbers (a b )
+  (standard-page ()
+      (<:p (<:as-html a "+" b "=" (+ a b)))
+      (<:p (<:a :href "." "try again"))))
+
 





More information about the ginseng-cvs mailing list