gpt4 book ai didi

lisp - 使用 Hunchentoot/html-template/Lisp 提供动态网页

转载 作者:太空宇宙 更新时间:2023-11-03 19:02:35 26 4
gpt4 key购买 nike

直到最近我将 Hunchentoot 升级到最新版本时,以下使用 Hunchentoot 和 html 模板的代码才允许我提供动态网页。有人可以建议我在下面的代码中哪里出了问题吗?我假设问题出在宏定义中?

(defmacro define-url-fn ((name) &body body)
`(progn
(defun ,name ()
,@body)
(push (create-prefix-dispatcher ,(format nil "/~(~a~).html" name) ',name) *dispatch-table*)))

(define-url-fn (sign-up)
(with-output-to-string (stream)
(let* ((values (list :username-error-msg *register-error*)))
(fill-and-print-template #p"/ELEPHUND/INTERFACE/sign-up.tmpl" values :stream stream))))

最佳答案

升级到 1.2.0 版后,我在使用 Hunchentoot 时也遇到了一些问题。如果您像我一样实例化类接受器的对象,您可能需要将其更改为使用类 easy-acceptor。

(push (make-instance 'easy-acceptor) *acceptors*)

然后你可以像以前一样继续使用create-prefix-dispatcher

关于lisp - 使用 Hunchentoot/html-template/Lisp 提供动态网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8296191/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com