服务器端 Java - 从哪里开始

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29550490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 08:11:45  来源:igfitidea点击:

Server side Java - where to start

javaserver

提问by joseph

I'm really starting to get a hang of the client-side Java programming, and from what I understand Java is great for developing stable server sides for large amounts of traffic.

我真的开始了解客户端 Java 编程,据我所知,Java 非常适合为大量流量开发稳定的服务器端。

The problem is that I'm completely new to server development, so I don't know where to start or where to look for information, despite Java's good documentation.

问题是我对服务器开发完全陌生,所以我不知道从哪里开始或从哪里寻找信息,尽管 Java 有很好的文档。

More specific questions:

更具体的问题:

  • Do you know any good, non-specific tutorials for server-side Java? I've seen some tutorials for Google's Cloud Platform and Netscape, but I don't want to be dependent on their infrastructure.
  • Is the common practice to develop your code in Eclipse and then "ship" it to your server? As I said I've never done server-side development and I've only tried learning a little node.js.
  • 你知道关于服务器端 Java 的任何好的、非特定的教程吗?我看过一些关于谷歌云平台和网景的教程,但我不想依赖他们的基础设施。
  • 在 Eclipse 中开发代码然后将其“发送”到服务器的常见做法是什么?正如我所说,我从未做过服务器端开发,我只尝试过学习一点 node.js。

Thank you in advance, I hope these questions aren't to wide-scoped.

在此先感谢您,我希望这些问题不要太广泛。

采纳答案by DominikAngerer

I would suggest you to start with a simple setup like you already told us: Eclipse + let's say an easy to use tomcat.

我建议您从一个简单的设置开始,就像您已经告诉我们的那样:Eclipse + 让我们说一个易于使用的tomcat

If it comes to the server side you need to create a Servlet which allows to access other application data from your server in a format which you define or let's say you + the clients define. I would suggest you to start with something you will be familiar like Json. For this I have a little "starting point" for you.

如果涉及到服务器端,您需要创建一个 Servlet,它允许以您定义的格式或假设您 + 客户端定义的格式从您的服务器访问其他应用程序数据。我建议你从你熟悉的东西开始,比如 Json。为此,我为您提供了一个小“起点”。

Clone that simple example for a server-side application: https://github.com/DominikAngerer/java-GsonJerseyProviderIt already provides you a simple structure for Json which is used by a Framework like Ember and also you can easy modify the structure which is defined there.

克隆服务器端应用程序的简单示例:https: //github.com/DominikAngerer/java-GsonJerseyProvider它已经为您提供了一个简单的 Json 结构,该结构由 Ember 等框架使用,您还可以轻松修改该结构在那里定义。

Is the common practice to develop your code in Eclipse and then "ship" it to your server?

在 Eclipse 中开发代码然后将其“发送”到服务器的常见做法是什么?

Yeah it's totally common to do that. Write your Server Side code and export it as .war - tomcat or jetty for example can simply deploy them and you will be able to run them on these application server.

是的,这样做很常见。编写您的服务器端代码并​​将其导出为 .war - 例如,tomcat 或 jetty 可以简单地部署它们,您将能够在这些应用程序服务器上运行它们。

Do you know any good, non-specific tutorials for server-side Java? I've seen some tutorials for Google's Cloud Platform and Netscape, but I don't want to be dependent on their infrastructure.

你知道关于服务器端 Java 的任何好的、非特定的教程吗?我看过一些关于谷歌云平台和网景的教程,但我不想依赖他们的基础设施。

I really love to work with Jersey - It's really a to understand the code you will write. Maybe try the example provided by IBM developersworks: http://www.ibm.com/developerworks/library/wa-aj-tomcat/

我真的很喜欢和 Jersey 一起工作 - 理解你将编写的代码真的很重要。也许试试 IBM developerworks 提供的例子:http: //www.ibm.com/developerworks/library/wa-aj-tomcat/

For the beginning it may be a little of a overhead but after you tried the example (it should be running right away) I think you will get the idea of how to create a simple backend system with java.

一开始,它可能有点开销,但是在您尝试了这个示例之后(它应该立即运行),我认为您将了解如何使用 java 创建一个简单的后端系统。

回答by Alberto Vazquez

If you want a complete environment out of the box, you can try:

如果你想要一个开箱即用的完整环境,你可以尝试:

  • Netbeans EE IDE:It contains a GlassFish server and the SDK preconfigured, glasfish is one of the most used open source application servers. Hereyou can find tutorials from the Netbeans page.

  • JBoss Developer Studio:is another very used IDE that includes a JBoss server. You can find tutorials from this one here.

  • Netbeans EE IDE:它包含一个 GlassFish 服务器和预配置的 SDK,glasfish 是最常用的开源应用服务器之一。您可以在此处找到来自 Netbeans 页面的教程。

  • JBoss Developer Studio:是另一个非常常用的 IDE,包括 JBoss 服务器。你可以在这里找到这个教程。

I would sugest to start with GlassFish, as it is very easy to use and configure.

我建议从 GlassFish 开始,因为它非常易于使用和配置。

回答by an earwig

Take a look at JavaEE. I would start by learning how to create simple JSP pages with Eclipse + Tomcat (create a "Dynamic Web Project"). After that, check out Servlets and be sure to understand HTTP. After that, I would get an overview of JSTL and other Java EE components. DZone has a nice refcardgiving you an overview of the Java EE 7 components. After that, you should be good enough to move on to a framework like Spring or Struts. Alternatively you can perfect Java EE fully learning it's more advanced components like CDI(context dependency injection) or JAX-RS and JAX-WS(web services). This document should give you an overview of how to configure a servlet container in eclipse: http://www.eclipse.org/webtools/community/education/web/t320/Configuring_an_Application_Server_in_Eclipse.pdf

看看JavaEE。我将首先学习如何使用 Eclipse + Tomcat 创建简单的 JSP 页面(创建一个“动态 Web 项目”)。之后,查看 Servlets 并确保了解 HTTP。之后,我将大致了解 JSTL 和其他 Java EE 组件。DZone 有一个很好的refcard为您提供了 Java EE 7 组件的概述。在那之后,您应该足够好,可以继续使用 Spring 或 Struts 之类的框架。或者,您可以完善 Java EE,充分学习它的更高级组件,如 CDI(上下文依赖注入)或 JAX-RS 和 JAX-WS(Web 服务)。本文档应概述如何在 Eclipse 中配置 servlet 容器:http: //www.eclipse.org/webtools/community/education/web/t320/Configuring_an_Application_Server_in_Eclipse.pdf

As for tutorials, check out Oracles JavaEE 7 tutorial at: http://docs.oracle.com/javaee/7/tutorial/

至于教程,请查看 Oracles JavaEE 7 教程:http: //docs.oracle.com/javaee/7/tutorial/

Alternatively, if you do not like the styles and patterns used in Java EE, there is a non-Java EE framework called the Play Framework (http://playframework.com) it gives you the option to develop your application using either Java or Scala, and uses MVC architecture.

或者,如果您不喜欢 Java EE 中使用的样式和模式,有一个称为 Play 框架 ( http://playframework.com)的非 Java EE 框架,它为您提供了使用 Java 或Scala,并使用MVC架构。

回答by Jay

If you want to learn server side programming with JAVA, I recommend to start working with Eclipse. Almost all developers whom I know are using one or another IDE, most of them are using Eclipse for J2EE.

如果您想学习使用 JAVA 进行服务器端编程,我建议您开始使用 Eclipse。我认识的几乎所有开发人员都在使用一种或另一种 IDE,他们中的大多数都使用 Eclipse for J2EE。

There are plenty of tutorials available on how to setup eclipse on your local computer. I personally read many tutorials when I learned it, you can google it.

有很多关于如何在本地计算机上设置 eclipse 的教程。我自己学的时候看了很多教程,大家可以google一下。

http://www.apekshit.com/t/11/Writing-JAVA-programs-in-Eclipse

http://www.apekshit.com/t/11/Writing-JAVA-programs-in-Eclipse

http://www.apekshit.com/JSP-Tutorial-for-beginners-with-Examples/c/21

http://www.apekshit.com/JSP-Tutorial-for-beginners-with-Examples/c/21

I found these 2 that might help you to achieve what you are looking for.

我发现这 2 个可能会帮助您实现所需的目标。