gpt4 book ai didi

clojure - 带有 compojure 的 hiccup 表单助手

转载 作者:行者123 更新时间:2023-12-02 16:04:27 25 4
gpt4 key购买 nike

异常:线程“main”中出现异常 java.io.FileNotFoundException:无法在类路径上找到 hiccup/form_helpers__init.class 或 hiccup/form_helpers.clj:

我正在尝试启动并运行一个玩具 compojure 应用程序。最初的应用程序来自 CloudBees 及其用于 Clojure/Compojure 的 ClickStart 应用程序。我正在尝试使用 hiccup form_helpers 添加一个简单的表单(还不会保留任何内容),但我收到了 ClassNotFound 异常。这是我所做的:

项目.clj:

(defproject mywebapp "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.4.0"]
[compojure "1.1.1"]
[hiccup "1.0.1"]]
:plugins [[lein-ring "0.7.3"]]
:ring {:handler mywebapp.routes/app}
:profiles
{:dev {:dependencies [[ring-mock "0.1.3"]]}})

views.clj:

(ns mywebapp.views
(:use [hiccup core page]
[hiccup form-helpers :only [form-to label text-area submit-button]]))
...
(defn shout-form []
[:div {:id "shout-form" }
(form-to [:post "/form"]
(label "shout" "What do you want to SHOUT?")
[:br]
(text-area "shout")
[:br]
(submit-button "SHOUT!"))])
...

最佳答案

啊,看起来我刚刚有一个旧的表单示例。 form_helpers 来自以前的版本。

如果我更改我的views.clj 文件:

(:use [hiccup form-helpers])

看起来像这样:

(:use [hiccup form])

(大概这会起作用,尽管我还没有测试过):

(:use [hiccup form :only [form-to label text-area submit-button]])

我不再收到错误消息。

澄清一下:该包以前称为“form_helpers”,现在简称为“form”。

关于clojure - 带有 compojure 的 hiccup 表单助手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15191715/

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