本文介绍了Web Java开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望开始使用Java进行网络开发-我有一些Java的基本知识,所以这不是问题,但是在破译Web应用程序中使用的各种技术时我很茫然.

I'm looking to start developing for the web using Java - I have some basic Java knowledge, so that's not a problem, but I'm at a loss when it comes to deciphering the various technologies for use in web applications.

我可以使用哪些选项?它们如何运作?有没有可以用来简化事情的类似于Django/Ruby on Rails的框架?

What options are available to me? How do they work? Are there any frameworks similar to Django/Ruby on Rails which I could use to simplify things?

任何有助于理解可用内容的链接将不胜感激.

Any links which could help with understanding what's available would be much appreciated.

推荐答案

Java框架有两种基本形式.一个叫做动作"框架,另一个叫做组件"框架.

Java frameworks come in two basic flavors. One is called the "Action" Framework, the other the "Component" Framework.

动作框架专门用于将HTTP请求映射到Java代码(动作),并将HTTP请求绑定到Java对象. Servlet是Action框架中最基本的,也是所有其他构建的基础.

Action frameworks specialize on mapping HTTP requests to Java code (actions), and binding HTTP Requests to Java objects. Servlets is the most basic of the Action Frameworks, and is the basic upon all of the others are built.

Struts是最受欢迎的Action框架,但是我不能凭良心向任何人推荐它. Struts 2和Stripes更现代,并且彼此非常相似.两者的配置都很轻巧,易于使用,提供了很好的绑定功能.

Struts is the most popular Action framework, but I can't in good conscience recommend it to anyone. Struts 2 and Stripes are more modern, and very similar to each other. Both are light on the configuration and easy to use out of the box, providing very good binding functionality.

组件框架专注于UI,并且倾向于基于高级UI组件(按钮,列表框等)促进事件驱动的体系结构.框架倾向于在几层以下隐藏来自编码器的实际HTTP请求.它们使开发更高级的UI变得容易得多. .NET是Windows的组件框架.在Java上,流行的组件框架是JSF(标准)和Wicket.

Component Frameworks focus on the UI and tend to promote a more event driven architecture based on high level UI components (buttons, list boxes, etc.). The frameworks tend to hide that actual HTTP request from the coder under several layers. They make developing the more advanced UIs much easier. .NET is a component framework for Windows. On Java, the popular component frameworks are JSF (a standard) and Wicket.

通常,如果要创建网站".这更类似于呈现信息(例如博客或社区站点),因此Action框架可以更好地工作.这些网站通常更简单,经常添加书签,需要漂亮的URL"等.使用Action框架通常更容易做到这一点.

As a rule, if you're creating a "web site". that is something more akin to presenting information (like a blog, or a community site), the Action frameworks work better. These sites tend to be simpler, get bookmarked often, require "pretty URLs" etc. This is generally easier to do with an Action framework.

对于具有大量UI元素和复杂工作流程的后台应用程序,组件框架要好得多.您会发现,尤其是使用工具时,使用组件框架可以更快地将这些样式的应用程序组合在一起.但是组件框架的请求工作流程更为复杂,有时依赖于隐藏状态,大量POST操作等.许多框架具有可怕的" URL,有时还会创建难以添加书签的页面.

Component frameworks are much better for things like back office applications with lots of UI elements and complicated workflows. You'll find, particularly with tooling, that these style of apps will go together faster using a component framework. But component frameworks have more complicated request workflow, sometimes relying on hidden state, lots of POST actions, etc. Many have "horrible" URLs, and sometimes create pages that are difficult to bookmark.

这两个框架都可以用于这两个任务,只是有些框架比其他框架更适合该任务.

Both frameworks can be used for both tasks, just some are more suited to the task than others.

这些框架都不能直接解决持久性问题,但是许多框架都具有可与JPA/EJB3或Hibernate紧密配合的扩展模块或惯用语.

None of these frameworks directly address persistence, but many have extension modules or idioms that work tightly with JPA/EJB3 or Hibernate.

这篇关于Web Java开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 13:16