简体   繁体   English

在客户端使用GWT时需要在服务器上使用Java吗?

[英]do we need to use java at server when we use GWT for client?

I am planning to use mochiweb/erlang based server logic. 我打算使用基于mochiweb / erlang的服务器逻辑。 Can I use GWT and JSON for client side development? 我可以使用GWT和JSON进行客户端开发吗? Or do you recommend java script libraries like jQuery, PURE and Raphael? 还是建议使用jQuery,PURE和Raphael等Java脚本库?

Actually I disagree 100% with mblin, it is definitively possible to develop your frontend in GWT and use whatever type of backend for it. 实际上,我不同意mblin的100%意见,绝对有可能在GWT中开发您的前端并为其使用任何类型的后端。 Because GWT can access any type of service through HTTP (effectively doing AJAX) you can call the backend as long as it exposes it's operations through HTTP (ideally using REST). 因为GWT可以通过HTTP(有效地执行AJAX)访问任何类型的服务,所以您可以调用后端,只要它通过HTTP(理想情况下使用REST)公开其操作即可。 Checkout http://code.google.com/p/gwt-rails/ which provides a foundation to combine GWT and rails, or http://www.gwtphp.com/ GWT+PHP. 检出http://code.google.com/p/gwt-rails/ ,它为组合GWT和rails或http://www.gwtphp.com/ GWT + PHP提供了基础。

The whole point of GWT is that you can write your server-side and client-side code in Java, and have the framework compile that java to (supposedly optimized) javascript so it can run on the client. GWT的全部要点是,您可以用Java编写服务器端和客户端代码,并具有将Java编译为(据说已优化)JavaScript的框架,以便它可以在客户端上运行。 If you're clever enough, you could probably figure out how to make it work with a non GWT based server, but it would be an exercise in arcane hackery rather than practicality. 如果您足够聪明,您可能会想出如何使其与基于非GWT的服务器一起使用的方法,但这只是奥秘黑客的一种练习,而不是实用性。

JSON is just a data interchange format that's a subset of javascript, and doesn't have much to do with GWT other than the fact that GWT can use it to transmit data. JSON只是一种数据交换格式,它是javascript的一个子集,除了GWT可以使用它传输数据之外,它与GWT无关。

Short version: no, there would be no reason to try to use GWT with an erlang server, unless you just want to hack around with stuff for fun. 简短的版本:不,没有理由尝试将GWT与erlang服务器一起使用,除非您只是想随便玩玩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM