我尝试了各种入门例子定位的Compojure,我可以得到一个基本的Hello World示例的路线基本的HTML工作作为这样无法在类路径
(ns hello-world
(:use compojure.core ring.adapter.jetty)
(:require [compojure.route :as route]))
(defroutes example
(GET "/" [] "<h1>Hello World Wide Web!</h1>"))
(run-jetty example {:port 8080})
但是,当我尝试使用HTML佣工像这样
(ns hello-world
(:use compojure ring.adapter.jetty)
(:require [compojure.route :as route]))
(defroutes example
(GET "/" []
(html [:h1 "Hello World"])))
(run-jetty example {:port 8080})
然后我收到以下错误
[空]例外在线程“主要” java.io.FileNotFoundException:找不到compojure__init.cla ss或classpath上的compojure.clj:(core.clj:1)
可能是你提到(:使用compojure.core ring.adapter.jetty),而不是(:使用compojure ring.adapter.jetty)? – W55tKQbuRu28Q4xv 2010-05-26 04:29:32
intraweb中还有很多例子,包括(:使用compojure)。这似乎是Compojure 0.4之前的例子,如下所述。上面的问题仍然代表着仍然遵循这些例子的人。 – Xian 2010-05-27 11:45:27
我认为你的第二个例子缺少“[]”。它应该是(GET“/”[] ... – 2010-05-31 21:39:12