Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Post Can';我不能用LISP hunchentoot获得职位_Post_Lisp_Common Lisp_Hunchentoot - Fatal编程技术网

Post Can';我不能用LISP hunchentoot获得职位

Post Can';我不能用LISP hunchentoot获得职位,post,lisp,common-lisp,hunchentoot,Post,Lisp,Common Lisp,Hunchentoot,我尝试基于Hunchentoot实现一个简单的post示例 代码如下: (define-easy-handler (test :uri "/test") () (with-html-output-to-string (*standard-output* nil :prologue t :indent t) (:html (:body (:h1 "Test") (:form :action "/test2" :method "post" :id "

我尝试基于Hunchentoot实现一个简单的post示例

代码如下:

(define-easy-handler (test :uri "/test") () 
  (with-html-output-to-string (*standard-output* nil :prologue t :indent t)
    (:html 
     (:body
      (:h1 "Test")
      (:form :action "/test2" :method "post" :id "addform"
     (:input :type "text" :name "name" :class "txt")
     (:input :type "submit" :class "btn" :value "Submit"))))))

(define-easy-handler (test2 :uri "/test2") (name)
  (with-html-output-to-string (*standard-output* nil :prologue t :indent t)
    (:html 
     (:body
      (:h1 name)))))
我可以正确连接并查看文本输入表单。但是当我提交文本时,我会得到一个空白页面,我希望页面的标题在文本输入中给出


不确定出了什么问题,有人能提出建议吗?

将您的处理程序更改为此

(define-easy-handler (test2 :uri "/test2") (name)
  (with-html-output-to-string (*standard-output* nil :prologue t :indent t)
    (:html 
     (:body
     (:h1 (str name))))))
那么它应该会起作用。阅读cl who文件。 特别是关于本地宏的信息。 我在这里附上了相关文件

除以下本地宏外,既不是字符串也不是关键字,也不是以关键字开头的列表的表单将保持原样:

  • 看起来像(str form)的表单将替换为

    (let ((result form)) (when result (princ result s)))
    
    (loop for i below 10 do (str i)) =>
    (loop for i below 10 do
      (let ((#:result i))
        (when #:result (princ #:result *standard-output*))))
    
    (let ((result form)) (when result (write-string (escape-string result s))))
    
  • 看起来像(fmt表格*)的表格将替换为

    (format s form*)
    
    (loop for i below 10 do (fmt "~R" i)) => (loop for i below 10 do (format s "~R" i))
    
  • 看起来像(esc表单)的表单将替换为

    (let ((result form)) (when result (princ result s)))
    
    (loop for i below 10 do (str i)) =>
    (loop for i below 10 do
      (let ((#:result i))
        (when #:result (princ #:result *standard-output*))))
    
    (let ((result form)) (when result (write-string (escape-string result s))))
    
  • 如果一个表单看起来像(htm form*),那么每个表单都将遵循我们刚才描述的转换规则,即,这是一个用with-HTML-OUTPUT的另一个调用包装的主体

    (loop for i below 100 do (htm (:b "foo") :br))
    => (loop for i below 100 do (progn (write-string "<b>foo</b><br />" s)))
    
    (100 do以下i的循环(htm(:b“foo”):br))
    =>(低于100 do的i循环(progn(写入字符串“foo
    ”s)))

非常感谢。它起作用了。我将尝试在文档中抓住这一点。