Wicket 是适合单页应用程序的 Web Java 框架吗? [英] Is Wicket a suitable Web java framework for Single Page Applications?

查看:58
本文介绍了Wicket 是适合单页应用程序的 Web Java 框架吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

或者对于这种应用程序,SPA 有最好的选择(框架)吗?

Or there are best options (frameworks) for this kind of application, SPA?

我只对使用 Scala 或 Java 框架进行后端开发感兴趣.

I'm interested in use only Scala or Java frameworks for backend development.

对我来说选择后端 Web 框架的主要要点是:

And the mainly important points for choose a backend web framework for me are:

  • 良好的文档、资源和许多示例
  • 成熟并被社区广泛采用,并具有大量实际用例.
  • 简单而简短的学习曲线.
  • 一种简单而广泛的架构,可以轻松使用或添加身份验证、授权等功能,以及网络应用中常见的其他功能.

推荐答案

是的,你可以用 Wicket 构建一个 SPA,它的组件架构实际上让它变得非常简单.

Yes, you can build a SPA with Wicket, and its component architecture actually makes it very simple.

基本上,通常应用程序中的页面是什么,你变成了一个面板,并使用 Ajax 制作单页切换面板,而不是在页面之间导航.您可以为页面的多个部分使用多个面板,等等.所有这一切都非常简单和自然的框架.从 5.x 开始添加的事件架构使得使用段间通信变得更加简单.

Basically, what would be a page in an usual application, you turn into a Panel, and make the single page switch panels with Ajax instead of navigating between pages. You can use multiple panels for multiple sections of the page, etc. All this is very simple and natural with the framework. The event architecture, added since 5.x, makes it even simpler to use inter-section communication.

不过,您失去的一件事是页面的书签功能.

The one thing you lose, though, is bookmark-ability of pages.

由于它是单个页面,因此浏览器地址栏中的 URL 永远不会改变,如果用户创建书签,它总是会点击初始页面,而不是创建书签时显示的页面.

Since it's a single page, the URL in the browser's address bar won't ever change, and if the user creates a bookmark, it will always hit the initial page, not the page shown when the bookmark was made.

客户端(基于 javascript 的)框架(如 GWT)通常通过使用动态锚点(URL 中 # 之后的字符串)对当前状态进行编码来实现这一点,以便应用程序可以在需要时重建它,但是一个以服务器为中心的框架,Wicket 做不到(至少,不是没有太多的自定义代码).可能,可行,但需要一些思考和工作.

Client-side (javascript-based) frameworks (like GWT) usually implement this by using dynamic anchors (the string in the URL after #) to encode the current state, so that the app can reconstruct it if needed, but being a server-centric framework, Wicket can't do it (at least, not without much custom code). Possible, doable, but will require some thought and work.

很多时候这不是必需的功能(或者甚至可能是不受欢迎的行为).如果是这样的话,Wicket 真的可以帮到你.

Many times this isn't a required feature (or may even be an undesirable behaviour). If that is the case, Wicket can really help you.

关于使用基于动作的框架(Struts、Spring MVC、Play 等),如果你想要一个客户端密集的架构,它们更合适.但是您将不可避免地使用 Javascript 或使用一些 Java 到 javascript 编译器 (GWT) 编写大部分应用程序,并使用框架来进行查询,我的意思是,实现服务(XML、JSON 或某些变体).

About using action-based frameworks (Struts, Spring MVC, Play, etc.), they are more appropriate if you want a client-heavy architecture. But you'll inevitably code most of your application in Javascript, or using some Java-to-javascript-compiler (GWT), and use the framework just to make the queries, I mean, implement the services (XML, JSON, or some variant).

这篇关于Wicket 是适合单页应用程序的 Web Java 框架吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆