[hunchentoot-devel] easy-handler outputs to REPL instead of client

Edi Weitz edi at agharta.de
Fri Dec 23 08:05:02 UTC 2011


Your loop doesn't return anything, does it?

On Thu, Dec 22, 2011 at 11:51 PM, Tyler Smith
<tyler.smith at 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 at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>




More information about the Tbnl-devel mailing list