简体   繁体   English

Java原教旨主义者的Web客户端开发技术

[英]Web client development technology for java fundamentalist

I am a java developer and I would like to develop rich clients for the web. 我是Java开发人员,我想为网络开发富客户端。 My problem is that I hate javascript, flash, etc. and most of the programming languages usually used for web client. 我的问题是我讨厌javascript,flash等,以及通常用于网络客户端的大多数编程语言。 I would be happy to keep doing java to develop web clients that may be used on common web browsers and, why not, on new fashion mobile devices. 我很乐意继续使用Java开发可在常见的Web浏览器上使用的Web客户端,以及为什么不在新型时尚的移动设备上使用。 I am looking for some advices/warnings to make a good choice. 我正在寻找一些建议/警告,以做出一个不错的选择。

Java applet seems perfect for my case, but according to some rumors, it is not a really sustainable solution. Java applet对于我来说似乎很完美,但是根据一些谣言,这不是一个真正可持续的解决方案。 Should I have a look at JavaFX? 我应该看看JavaFX吗? GWT? GWT? Are there some other possibilities? 还有其他可能性吗?

What do you want to do? 你想让我做什么? Vaadin is based on GWT and therefore utilizes HTML5 + JavaScript which is much slower than a Java Applet. Vaadin基于GWT,因此使用的HTML5 + JavaScript比Java Applet慢得多。 I have tried boat and Applets with Swing is A LOT faster than Vaadin. 我尝试过船,带有Swing的Applet比Vaadin快很多。

With Java Applets, Swing and Hessian you have unbeatable performance for business applications. 使用Java Applets,Swing和Hessian,您可以在业务应用程序中获得无与伦比的性能。 Hessian is a very fast binary web service protocol. Hessian是一种非常快速的二进制Web服务协议。 With JavaScript you are usually limited to text-encoded web service protocols like Json and various XML-based protocols. 使用JavaScript,通常只能使用文本编码的Web服务协议(例如Json)和各种基于XML的协议。 Text-based protocols consume a lot of CPU, memory and bandwidth compared to binary protocols - and they don't really provide you with any advantage at all. 与二进制协议相比,基于文本的协议会占用大量CPU,内存和带宽-而且它们根本无法为您提供任何优势。

The weak point of Applets is hardware accelerated graphics like OpenGL and multimedia. Applets的弱点是硬件加速图形,例如OpenGL和多媒体。 If you are developing games or movie players Applets is not that great. 如果您正在开发游戏或电影播放器​​,Applet并不是很好。

JavaFX promise to fix hardware accelerated graphics performance and video codecs. JavaFX承诺会修复硬件加速的图形性能和视频编解码器。 With your description it is not clear if you need to wait for that. 根据您的描述,不清楚您是否需要等待。

However if you really need more than what standard applets will provide you than web start may be a solution. 但是,如果您真正需要的不是标准的applet所能提供的功能,而是Web Start可能是解决方案。 Its a bit like the old ActiveX with signed or unsigned application that gets extra privileges - either by being signed by sun or by asking the user. 有点像带有签名或未签名应用程序的旧ActiveX,它具有额外的特权-通过被sun签名或询问用户。 This will allow you to use JOGL or a 3d scene graph engine. 这将允许您使用JOGL或3d场景图形引擎。

You are a perfect fit for JavaServer Faces (JSF). 您非常适合JavaServer Faces(JSF)。 Yes just try them on. 是的,只需试一试。 Look, you look great in them. 看,你看起来很棒。 The appeal of JSF is 1. It is a standardardized technology, part of Java EE 2. It relies a lot on Java programming over any JavaScript coding (which is not done at all). JSF的吸引力在于1.它是一种标准化技术,是Java EE的一部分。2。它非常依赖Java编程,而不依赖于任何JavaScript编码(根本没有做到)。 3. JSF has been around for awhile, and it works quite well. 3. JSF已经存在了一段时间,并且运行良好。 In addition, JSF works with Ajax, out of the box (an added bonus), without writing a single syllable of JavaScript. 另外,JSF开箱即用地与Ajax配合使用(额外的好处),而无需编写一个JavaScript音节。 The only downside is that you will have to code some html, and the "facelets" are basically html pages with some extra tags thrown in that you need to learn. 唯一的缺点是您将必须编写一些html代码,而“ facelets”基本上是html页面,并带有一些您需要学习的额外标签。 But the vast majority of the real processing is done in Java. 但是绝大多数的真实处理都是用Java完成的。 JSF also works without the extra baggage of Java EE, it was built to work with a plain Tomcat like server (or Glassfish or JBoss, etc) and a browser, and Java SE (the desktop version). JSF还可以在不增加Java EE负担的情况下工作,它是为与普通的Tomcat(如服务器(或Glassfish或JBoss等),浏览器和Java SE(桌面版本)一起使用而构建的。

I think JavaFX looks very promising as a Java-based RIA technology. 我认为JavaFX作为基于Java的RIA技术看起来非常有前途。 It's cutting edge though. 不过这是最前沿的。 Mac OS X and Linux versions are only available as a preview yet. Mac OS X和Linux版本仅提供预览。 Mobile and other device support has been announced but its not out yet, AFAIK. 已经宣布了对移动和其他设备的支持,但尚未宣布支持AFAIK。

Vaadin would also be suitable, requiring no Javascript or HTML at all, even for new component development. Vaadin也将是合适的,即使对于新组件开发,也完全不需要Javascript或HTML。 Page layout is done using layout managers (like Swing). 页面布局是使用布局管理器(如Swing)完成的。 New components can be composed from existing components (again, like Swing), or written from scratch using GWT (fairly straightforward, and pure Java). 新组件可以由现有组件组成(再次类似于Swing),也可以使用GWT从头开始编写(相当简单,纯Java)。

There is a reasonable selection of add-ons covering some features not in the core framework. 可以合理选择包含核心框架中未包含的某些功能的附加组件。

The framework is very easy to use for Java developers with Swing experience, and has a polished look and feel out of the box. 对于具有Swing经验的Java开发人员而言,该框架非常易于使用,并且具有开箱即用的优美外观。 However, the layout managers do make it difficult to change the look and feel using CSS - simple tasks like adding borders are hard. 但是,布局管理器确实很难使用CSS来改变外观-像添加边框这样的简单任务很难。

The layout is also quite "heavy", which means that Vaadin websites can feel slightly sluggish. 布局也相当“繁重”,这意味着Vaadin网站可能会显得有些呆滞。 In my experience, the feel is still better than some of the heavier JSF frameworks. 以我的经验,这种感觉仍然比某些较重的JSF框架要好。

It is compatible with all major browsers. 它与所有主流浏览器兼容。

Demonstrator: http://demo.vaadin.com/sampler/ 演示者: http : //demo.vaadin.com/sampler/

You could also consider Wicket . 您也可以考虑Wicket This has a similar component-based approach, but the components are defined using simple HTML fragments, which results in a much lighter DOM (and therefore better browser performance) and far better control over the look and feel. 这具有类似的基于组件的方法,但是使用简单的HTML片段定义了组件,这导致DOM轻得多(因此浏览器性能更好),并且对外观的控制更好。 Wicket has a steeper learning curve, however. Wicket的学习曲线较陡。

After trying GWT and struggling with its so-called "super-dev mode", I discovered JavaScript programming was not so painful. 在尝试了GWT并尝试使用其所谓的“超级开发模式”后,我发现JavaScript编程并不是那么痛苦。 I forced myself to learn and practice and I finally fully adopted it. 我强迫自己学习和练习,终于完全采用了它。 There are numbers of nice things in JavaScript and a huge number of libraries. JavaScript和许多库中有许多不错的东西。 My recommendation for people in my case is just to persevere in learning JavaScript using for example w3schools tutorial . 对于我的情况,我的建议是仅坚持使用w3schools教程学习JavaScript。

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

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