I am writing a webapp in Clojure.
我在Clojure写一个webapp。
I almost want to use Google Web Toolkit for the frontend -- since I can just write Clojure/Java code, and have the library automatically generate the Javascript/AJAX.
我几乎想要为前端使用谷歌Web Toolkit——因为我可以编写Clojure/Java代码,并让库自动生成Javascript/AJAX。
However, for some reason, GWT does not sem to be used much in the real world.
然而,由于某些原因,GWT并没有在现实世界中大量使用。
Is there something that is similarly tied into Java (like GWT is) but more popular?
是否有类似于Java(如GWT)但更流行的东西?
Thanks!
谢谢!
6 个解决方案
#2
8
GWT is used in the real world!!! A lot! And google is doing some pretty huge things with it so I don't think popularity is a valid concern.
GWT在现实世界中使用!!!很多!谷歌正在用它做一些非常大的事情,所以我不认为流行是一个合理的考虑。
I don't want to start a flame war so I won't elaborate any more on this.
我不想挑起一场激烈的战争,所以我就不详细讲了。
Also, remember that GWT is a java - javascript compiler. No bytecode will run on the client. Hence, you can only use java, not clojure code when writing client-side code.
另外,请记住GWT是一个java - javascript编译器。客户机上不会运行字节码。因此,在编写客户端代码时只能使用java,而不能使用clojure代码。
#3
6
GWT is not particularly useful with Clojure, because it (GWT) uses a custom compiler that reads Java source code (not bytecode). Unless you want to write all your user-interface code in Java, GWT will not help you.
GWT对Clojure不是特别有用,因为它(GWT)使用一个读取Java源代码的自定义编译器(不是字节码)。除非您想用Java编写所有用户界面代码,否则GWT不会帮助您。
#4
0
Now ClojurescriptOne is a good way on an alternative to GWT. The things I found missing so far are full source optimization, and of course some customized libraries.
现在,ClojurescriptOne是一种替代GWT的好方法。到目前为止,我发现缺少的东西都是完整的源代码优化,当然还有一些定制的库。
Also for instance clojurescriptone does only compile javascript to one file, does not yet create cached html-files to further speed up load times like GWT does.
此外,例如clojurescriptone只将javascript编译为一个文件,还没有创建缓存的html文件,以便像GWT一样进一步提高加载速度。
The support for Google Closure is not fully wrapped yet so you have to use interops. That said, I still think this is an equivalently good alternative compared to java-programming in GWT.
谷歌闭包的支持还没有完全包装,所以您必须使用interops。尽管如此,与GWT中的java编程相比,我仍然认为这是一个相当不错的选择。
#5
0
You might also want to check out my micro-framework supporting development of AJAX apps with Clojure/Ring/Compojure/lib-noir stack:
您可能还想看看我支持开发带有Clojure/Ring/Compojure/lib-noir堆栈的AJAX应用的微框架:
http://ganelon.tomeklipski.com
http://ganelon.tomeklipski.com
It does not copy execution model of GWT, but rather works like Vaadin or Weblocks (but without session-statefulness or complicated UI components): it simply lets your XHR handlers return side effects to be applied to a page client-side through thin (and extendable) JavaScript layer.
它不复制GWT的执行模型,而是像Vaadin或Weblocks(但没有会话状态或复杂的UI组件):它只是让您的XHR处理程序返回副作用,通过瘦(可扩展)JavaScript层应用到页面客户端。
For example: response from XHR handler can update part of a page by #id or display Bootstrap's Modal or redirect browser to a new url - but you can really easy add own operations.
例如:XHR处理程序的响应可以通过#id更新页面的一部分,或者显示引导程序的模式或重定向浏览器到新的url——但是您可以很容易地添加自己的操作。
#6
0
I realise this question was asked long ago, but there is now a direct answer - ClojureScript. It allows you to directly compile clojure code into javascript, and supports most of the common clojure idioms.
我知道这个问题很久以前就有人问过,但现在有了一个直接的答案——ClojureScript。它允许您直接将clojure代码编译成javascript,并支持大多数常见的clojure习惯用法。
#1
#2
8
GWT is used in the real world!!! A lot! And google is doing some pretty huge things with it so I don't think popularity is a valid concern.
GWT在现实世界中使用!!!很多!谷歌正在用它做一些非常大的事情,所以我不认为流行是一个合理的考虑。
I don't want to start a flame war so I won't elaborate any more on this.
我不想挑起一场激烈的战争,所以我就不详细讲了。
Also, remember that GWT is a java - javascript compiler. No bytecode will run on the client. Hence, you can only use java, not clojure code when writing client-side code.
另外,请记住GWT是一个java - javascript编译器。客户机上不会运行字节码。因此,在编写客户端代码时只能使用java,而不能使用clojure代码。
#3
6
GWT is not particularly useful with Clojure, because it (GWT) uses a custom compiler that reads Java source code (not bytecode). Unless you want to write all your user-interface code in Java, GWT will not help you.
GWT对Clojure不是特别有用,因为它(GWT)使用一个读取Java源代码的自定义编译器(不是字节码)。除非您想用Java编写所有用户界面代码,否则GWT不会帮助您。
#4
0
Now ClojurescriptOne is a good way on an alternative to GWT. The things I found missing so far are full source optimization, and of course some customized libraries.
现在,ClojurescriptOne是一种替代GWT的好方法。到目前为止,我发现缺少的东西都是完整的源代码优化,当然还有一些定制的库。
Also for instance clojurescriptone does only compile javascript to one file, does not yet create cached html-files to further speed up load times like GWT does.
此外,例如clojurescriptone只将javascript编译为一个文件,还没有创建缓存的html文件,以便像GWT一样进一步提高加载速度。
The support for Google Closure is not fully wrapped yet so you have to use interops. That said, I still think this is an equivalently good alternative compared to java-programming in GWT.
谷歌闭包的支持还没有完全包装,所以您必须使用interops。尽管如此,与GWT中的java编程相比,我仍然认为这是一个相当不错的选择。
#5
0
You might also want to check out my micro-framework supporting development of AJAX apps with Clojure/Ring/Compojure/lib-noir stack:
您可能还想看看我支持开发带有Clojure/Ring/Compojure/lib-noir堆栈的AJAX应用的微框架:
http://ganelon.tomeklipski.com
http://ganelon.tomeklipski.com
It does not copy execution model of GWT, but rather works like Vaadin or Weblocks (but without session-statefulness or complicated UI components): it simply lets your XHR handlers return side effects to be applied to a page client-side through thin (and extendable) JavaScript layer.
它不复制GWT的执行模型,而是像Vaadin或Weblocks(但没有会话状态或复杂的UI组件):它只是让您的XHR处理程序返回副作用,通过瘦(可扩展)JavaScript层应用到页面客户端。
For example: response from XHR handler can update part of a page by #id or display Bootstrap's Modal or redirect browser to a new url - but you can really easy add own operations.
例如:XHR处理程序的响应可以通过#id更新页面的一部分,或者显示引导程序的模式或重定向浏览器到新的url——但是您可以很容易地添加自己的操作。
#6
0
I realise this question was asked long ago, but there is now a direct answer - ClojureScript. It allows you to directly compile clojure code into javascript, and supports most of the common clojure idioms.
我知道这个问题很久以前就有人问过,但现在有了一个直接的答案——ClojureScript。它允许您直接将clojure代码编译成javascript,并支持大多数常见的clojure习惯用法。