Your loop doesn't return anything, does it?
On Thu, Dec 22, 2011 at 11:51 PM, Tyler Smith tyler.smith@mail.mcgill.ca wrote:
Hi,
I'm trying to set up a simple sql-based website using cl-who, cl-sql and hunchentoot. I've got the basic cl-sql and cl-who parts working, but I'm having a trouble serving the pages with hunchentoot.
The following works as expected:
(ql:quickload :hunchentoot) (use-package :hunchentoot)
(setf my-acceptor (start (make-instance 'hunchentoot:easy-acceptor :port 4242)))
(define-easy-handler (tyler :uri "/tyler") () (with-html-output (*standard-output*) (:ul (:li "hi there again"))))
After this, if I open localhost:4242/tyler in a browser I see my unordered list. However, with this:
(define-easy-handler (tyler :uri "/tyler") () (multiple-value-bind (records fields) (select [genus] [species] :from "specimens") (loop for rec in records do (loop for label in fields for val in rec do (with-html-output (*standard-output*) (:dt :class label (str label)) (:dd :class label (str val)))))))
When I browse to localhost:4242/tyler nothing appears in the browser, instead the html is printed in the REPL. If I evaluate just the (M-V-B ...) form without the enclosing (D-E-H ...) it outputs the html to the REPL as I expect.
I have been following the examples in the hunchentoot docs, but I'm stumped as to why this doesn't work. What have I missed?
Thanks,
Tyler
tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel