编写基于Java的Web应用程序并在个人计算机上测试它需要什么?

时间:2022-01-20 08:36:01

I currently have Apache HTTP Server, but I'm guessing I'll need Tomcat (and then have to configure it in a way that makes it not open to the public), a Java JDK (which I already have, but should probably update), and an IDE (I have Eclipse). But what else should I have or know before starting?

我目前有Apache HTTP Server,但我猜我需要Tomcat(然后必须以一种不向公众开放的方式配置它),一个Java JDK(我已经拥有,但应该更新) )和IDE(我有Eclipse)。但在开始之前我还应该拥有或知道什么呢?

10 个解决方案

#1


3  

Lets see... you'll need:

让我们看看......你需要:

  1. A JDK. Preferably the Standard Edition, unless you plan on using GlassFish as a J2EE server. If you do use the standard edition, you need to include the jars from your servlet container/J2EE stack to access J2EE libraries.
  2. 一个JDK。除非您计划将GlassFish用作J2EE服务器,否则最好使用Standard Edition。如果您确实使用标准版,则需要包含servlet容器/ J2EE堆栈中的jar以访问J2EE库。

  3. A Servlet container. Apache Tomcat is a popular one, and Eclipse already has integration support for it. Keep in mind that Tomcat is not a complete J2EE stack... you need something like JBoss Application Server or Apache Geronimo for that.
  4. 一个Servlet容器。 Apache Tomcat很受欢迎,Eclipse已经为它提供了集成支持。请记住,Tomcat不是一个完整的J2EE堆栈......你需要像JBoss Application Server或Apache Geronimo这样的东西。

  5. (Semi-Optional) A web server. Apache Web Server surprisingly works well with Apache Tomcat or Apache Geronimo... it's almost like they were made by the same people! Eclipse has built-in support for Tomcat and doesn't appear to require a web server because of it. I could be wrong, though.
  6. (半可选)Web服务器。 Apache Web Server令人惊讶地与Apache Tomcat或Apache Geronimo一起使用......它几乎就像是由同一个人制作的! Eclipse内置了对Tomcat的支持,因此它似乎不需要Web服务器。不过我可能错了。

  7. (Optional) An IDE. If you use Eclipse, get the version for Java EE Developers.
  8. (可选)IDE。如果您使用Eclipse,请获取Java EE Developers的版本。

  9. (Optional) A Database. MySQL and HSQLDB are popular ones for Java, at least for small to medium applications. Keep in mind that you also need to download the JDBC drivers for your database.
  10. (可选)数据库。 MySQL和HSQLDB是Java的流行版本,至少对于中小型应用程序而言。请记住,您还需要下载数据库的JDBC驱动程序。

  11. (Optional) A revision control system. Even on a single-developer project, a revision control system can save your hide if you accidentally remove code or a file that you shouldn't. There are several choices here; Subversion is my personal choice, along with an Eclipse plugin for it, such as Subclipse.
  12. (可选)修订控制系统。即使在单个开发人员项目中,如果您不小心删除了不应删除的代码或文件,修订控制系统也可以保存您的隐藏。这里有几种选择; Subversion是我个人的选择,以及它的Eclipse插件,比如Subclipse。

#2


3  

I'd recommend having a database server installed as well- you can go pretty far with the various pure Java implementations, but anything significant will probably benefit from having a copy of MySQL around.

我建议安装一个数据库服务器 - 你可以使用各种纯Java实现,但任何重要的东西都可能从拥有MySQL的副本中受益。

I'd also get some sort of version control going- tortoiseSVN works really well for windows. Even if you're just goofing around for yourself, getting in the habit of using it will save time and heartache down the road.

我也会得到一些版本控制 - tortoiseSVN非常适合windows。即使你只是为自己闲逛,养成使用它的习惯也可以节省时间和心痛。

#3


3  

If you're trying to stay pretty simple you have everything you need; a servlet container.

如果你想保持简单,那就拥有你需要的一切;一个servlet容器。

The IDE of course helps.

IDE当然有帮助。

I would recommend Eclipse's Web tools project as it will allow you to code, and then hit a button that will put that code on tomcat all from the IDE.

我建议使用Eclipse的Web工具项目,因为它允许您编写代码,然后点击一个按钮,将该代码放在tomcat上。

http://www.eclipse.org/webtools/

As Bogdan mentioned maven is a dependency management tool but depending on your level of comfort I'm not sure if you want to muddy the water with that yet.

正如波格丹提到的那样,maven是一种依赖管理工具,但根据你的舒适程度,我不确定你是否想要用水淹没水。

Another project that uses Maven is appfuse (http://appfuse.org/display/APF/Home) and will help you get off the ground quickly for generating a webapp. It will give you a webapp, a database, unit tests, dependency management, and a good skeleton to structure your project off of.

另一个使用Maven的项目是appfuse(http://appfuse.org/display/APF/Home),它将帮助您快速开始生成Web应用程序。它将为您提供webapp,数据库,单元测试,依赖关系管理以及构建项目的良好框架。

So, if you're just wanting to play around with some .jsps and a servlet or two I would stick with the IDE, but if you're comfortable with web applications, MVC, and build tools I'd recommend appfuse.

所以,如果你只是想要使用一些.jsps和一两个servlet,我会坚持使用IDE,但如果你对web应用程序,MVC和构建工具感到满意,我建议使用appfuse。

#4


1  

That's all you need from the tools.

这就是你需要的所有工具。

Then, you need to google some tutorial on using servlets and jsp pages. Even documentation bundled with tomcat is good enough.

然后,你需要谷歌一些关于使用servlet和jsp页面的教程。即使是与tomcat捆绑在一起的文档也足够好了。

#5


1  

You'll probably also want a database like MySQL or HSQLDB. You could replace Tomcat with Jetty which is often easier to get class changes to reload without restarting the server.

您可能还需要MySQL或HSQLDB等数据库。您可以使用Jetty替换Tomcat,这通常更容易让类更改重新加载而无需重新启动服务器。

#6


1  

You can do everything from within NetBeans if you're willing to switch IDEs (it's a relatively painless switch, but you might be able to create a similar setup in Eclipse). There's a Tomcat plugin for NetBeans that allows you to create, edit, run, and debug servlet and JSP web apps all from within NetBeans. There's a starter tutorial here. When you install the Tomcat plugin, you get lots of good example servlets and JSPs as a bonus.

如果您愿意切换IDE,那么您可以在NetBeans中执行所有操作(这是一个相对轻松的开关,但您可以在Eclipse中创建类似的设置)。 NetBeans有一个Tomcat插件,允许您从NetBeans中创建,编辑,运行和调试所有servlet和JSP Web应用程序。这里有一个入门教程。当您安装Tomcat插件时,您将获得许多优秀的servlet和JSP作为奖励。

#7


0  

I would go for maven.

我会去找maven。

It will give you a quick start in configuring your project (by using archetypes) and it will manage your dependencies.

它将为您提供配置项目的快速入门(通过使用原型),它将管理您的依赖项。

Install it and run the archetype command to create your project.

安装它并运行archetype命令来创建项目。

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp

After that just use the maven eclipse plugin to configure your eclipse environment for that project (http://maven.apache.org/plugins/maven-eclipse-plugin/).

之后,只需使用maven eclipse插件为该项目配置eclipse环境(http://maven.apache.org/plugins/maven-eclipse-plugin/)。

#8


0  

I currently have Apache HTTP Server, but I'm guessing I'll need Tomcat (and then have to configure it in a way that makes it not open to the public)

我目前有Apache HTTP Server,但我猜我需要Tomcat(然后必须以一种不向公众开放的方式配置它)

For simple Java based web applications, you need not have Apache installed unless you are too concerned about performance and want to gain by letting Apache serve static resources.

对于简单的基于Java的Web应用程序,您不需要安装Apache,除非您过于关注性能并希望通过让Apache提供静态资源来获得。

But what else should I have or know before starting?

但在开始之前我还应该拥有或知道什么呢?

A good IDE is most recommended, otherwise the development will become painful. Use a simple database as people have already suggested. I would go with MySQL because its neither too complex for a webapp nor too trivial.

最值得推荐的是IDE,否则开发会变得很痛苦。使用人们已经建议的简单数据库。我会选择MySQL,因为它对于webapp既不太复杂也不太简单。

#9


0  

Instead of Tomcat I recommend Jetty, that is also a Servlet-Container. In my experience it's easier to setup and maintain. Good enough to test your application.

而不是Tomcat我推荐Jetty,它也是一个Servlet-Container。根据我的经验,它的设置和维护更容易。足以测试您的应用程序。

Other than that you need a JDK (naturally). A database is optional, but if your web-app wants to save data it's the best option.

除此之外,你需要一个JDK(自然)。数据库是可选的,但如果您的网络应用程序想要保存数据,那么它是最佳选择。

#10


0  

Step 1:you need to have J2EE installed in your system if not download it from http://www.oracle.com/technetwork/java/javaee/downloads/index.html here.

步骤1:如果不从http://www.oracle.com/technetwork/java/javaee/downloads/index.html下载,则需要在系统中安装J2EE。

Step 2: Should have Apache TomCat server to run your web project on your system locally(local Server). installation steps https://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html go to this website.

步骤2:应该让Apache TomCat服务器在您的系统上本地运行您的Web项目(本地服务器)。安装步骤https://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html转到此网站。

Step 3:set Class path for java JRE.

第3步:设置java JRE的类路径。

#1


3  

Lets see... you'll need:

让我们看看......你需要:

  1. A JDK. Preferably the Standard Edition, unless you plan on using GlassFish as a J2EE server. If you do use the standard edition, you need to include the jars from your servlet container/J2EE stack to access J2EE libraries.
  2. 一个JDK。除非您计划将GlassFish用作J2EE服务器,否则最好使用Standard Edition。如果您确实使用标准版,则需要包含servlet容器/ J2EE堆栈中的jar以访问J2EE库。

  3. A Servlet container. Apache Tomcat is a popular one, and Eclipse already has integration support for it. Keep in mind that Tomcat is not a complete J2EE stack... you need something like JBoss Application Server or Apache Geronimo for that.
  4. 一个Servlet容器。 Apache Tomcat很受欢迎,Eclipse已经为它提供了集成支持。请记住,Tomcat不是一个完整的J2EE堆栈......你需要像JBoss Application Server或Apache Geronimo这样的东西。

  5. (Semi-Optional) A web server. Apache Web Server surprisingly works well with Apache Tomcat or Apache Geronimo... it's almost like they were made by the same people! Eclipse has built-in support for Tomcat and doesn't appear to require a web server because of it. I could be wrong, though.
  6. (半可选)Web服务器。 Apache Web Server令人惊讶地与Apache Tomcat或Apache Geronimo一起使用......它几乎就像是由同一个人制作的! Eclipse内置了对Tomcat的支持,因此它似乎不需要Web服务器。不过我可能错了。

  7. (Optional) An IDE. If you use Eclipse, get the version for Java EE Developers.
  8. (可选)IDE。如果您使用Eclipse,请获取Java EE Developers的版本。

  9. (Optional) A Database. MySQL and HSQLDB are popular ones for Java, at least for small to medium applications. Keep in mind that you also need to download the JDBC drivers for your database.
  10. (可选)数据库。 MySQL和HSQLDB是Java的流行版本,至少对于中小型应用程序而言。请记住,您还需要下载数据库的JDBC驱动程序。

  11. (Optional) A revision control system. Even on a single-developer project, a revision control system can save your hide if you accidentally remove code or a file that you shouldn't. There are several choices here; Subversion is my personal choice, along with an Eclipse plugin for it, such as Subclipse.
  12. (可选)修订控制系统。即使在单个开发人员项目中,如果您不小心删除了不应删除的代码或文件,修订控制系统也可以保存您的隐藏。这里有几种选择; Subversion是我个人的选择,以及它的Eclipse插件,比如Subclipse。

#2


3  

I'd recommend having a database server installed as well- you can go pretty far with the various pure Java implementations, but anything significant will probably benefit from having a copy of MySQL around.

我建议安装一个数据库服务器 - 你可以使用各种纯Java实现,但任何重要的东西都可能从拥有MySQL的副本中受益。

I'd also get some sort of version control going- tortoiseSVN works really well for windows. Even if you're just goofing around for yourself, getting in the habit of using it will save time and heartache down the road.

我也会得到一些版本控制 - tortoiseSVN非常适合windows。即使你只是为自己闲逛,养成使用它的习惯也可以节省时间和心痛。

#3


3  

If you're trying to stay pretty simple you have everything you need; a servlet container.

如果你想保持简单,那就拥有你需要的一切;一个servlet容器。

The IDE of course helps.

IDE当然有帮助。

I would recommend Eclipse's Web tools project as it will allow you to code, and then hit a button that will put that code on tomcat all from the IDE.

我建议使用Eclipse的Web工具项目,因为它允许您编写代码,然后点击一个按钮,将该代码放在tomcat上。

http://www.eclipse.org/webtools/

As Bogdan mentioned maven is a dependency management tool but depending on your level of comfort I'm not sure if you want to muddy the water with that yet.

正如波格丹提到的那样,maven是一种依赖管理工具,但根据你的舒适程度,我不确定你是否想要用水淹没水。

Another project that uses Maven is appfuse (http://appfuse.org/display/APF/Home) and will help you get off the ground quickly for generating a webapp. It will give you a webapp, a database, unit tests, dependency management, and a good skeleton to structure your project off of.

另一个使用Maven的项目是appfuse(http://appfuse.org/display/APF/Home),它将帮助您快速开始生成Web应用程序。它将为您提供webapp,数据库,单元测试,依赖关系管理以及构建项目的良好框架。

So, if you're just wanting to play around with some .jsps and a servlet or two I would stick with the IDE, but if you're comfortable with web applications, MVC, and build tools I'd recommend appfuse.

所以,如果你只是想要使用一些.jsps和一两个servlet,我会坚持使用IDE,但如果你对web应用程序,MVC和构建工具感到满意,我建议使用appfuse。

#4


1  

That's all you need from the tools.

这就是你需要的所有工具。

Then, you need to google some tutorial on using servlets and jsp pages. Even documentation bundled with tomcat is good enough.

然后,你需要谷歌一些关于使用servlet和jsp页面的教程。即使是与tomcat捆绑在一起的文档也足够好了。

#5


1  

You'll probably also want a database like MySQL or HSQLDB. You could replace Tomcat with Jetty which is often easier to get class changes to reload without restarting the server.

您可能还需要MySQL或HSQLDB等数据库。您可以使用Jetty替换Tomcat,这通常更容易让类更改重新加载而无需重新启动服务器。

#6


1  

You can do everything from within NetBeans if you're willing to switch IDEs (it's a relatively painless switch, but you might be able to create a similar setup in Eclipse). There's a Tomcat plugin for NetBeans that allows you to create, edit, run, and debug servlet and JSP web apps all from within NetBeans. There's a starter tutorial here. When you install the Tomcat plugin, you get lots of good example servlets and JSPs as a bonus.

如果您愿意切换IDE,那么您可以在NetBeans中执行所有操作(这是一个相对轻松的开关,但您可以在Eclipse中创建类似的设置)。 NetBeans有一个Tomcat插件,允许您从NetBeans中创建,编辑,运行和调试所有servlet和JSP Web应用程序。这里有一个入门教程。当您安装Tomcat插件时,您将获得许多优秀的servlet和JSP作为奖励。

#7


0  

I would go for maven.

我会去找maven。

It will give you a quick start in configuring your project (by using archetypes) and it will manage your dependencies.

它将为您提供配置项目的快速入门(通过使用原型),它将管理您的依赖项。

Install it and run the archetype command to create your project.

安装它并运行archetype命令来创建项目。

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp

After that just use the maven eclipse plugin to configure your eclipse environment for that project (http://maven.apache.org/plugins/maven-eclipse-plugin/).

之后,只需使用maven eclipse插件为该项目配置eclipse环境(http://maven.apache.org/plugins/maven-eclipse-plugin/)。

#8


0  

I currently have Apache HTTP Server, but I'm guessing I'll need Tomcat (and then have to configure it in a way that makes it not open to the public)

我目前有Apache HTTP Server,但我猜我需要Tomcat(然后必须以一种不向公众开放的方式配置它)

For simple Java based web applications, you need not have Apache installed unless you are too concerned about performance and want to gain by letting Apache serve static resources.

对于简单的基于Java的Web应用程序,您不需要安装Apache,除非您过于关注性能并希望通过让Apache提供静态资源来获得。

But what else should I have or know before starting?

但在开始之前我还应该拥有或知道什么呢?

A good IDE is most recommended, otherwise the development will become painful. Use a simple database as people have already suggested. I would go with MySQL because its neither too complex for a webapp nor too trivial.

最值得推荐的是IDE,否则开发会变得很痛苦。使用人们已经建议的简单数据库。我会选择MySQL,因为它对于webapp既不太复杂也不太简单。

#9


0  

Instead of Tomcat I recommend Jetty, that is also a Servlet-Container. In my experience it's easier to setup and maintain. Good enough to test your application.

而不是Tomcat我推荐Jetty,它也是一个Servlet-Container。根据我的经验,它的设置和维护更容易。足以测试您的应用程序。

Other than that you need a JDK (naturally). A database is optional, but if your web-app wants to save data it's the best option.

除此之外,你需要一个JDK(自然)。数据库是可选的,但如果您的网络应用程序想要保存数据,那么它是最佳选择。

#10


0  

Step 1:you need to have J2EE installed in your system if not download it from http://www.oracle.com/technetwork/java/javaee/downloads/index.html here.

步骤1:如果不从http://www.oracle.com/technetwork/java/javaee/downloads/index.html下载,则需要在系统中安装J2EE。

Step 2: Should have Apache TomCat server to run your web project on your system locally(local Server). installation steps https://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html go to this website.

步骤2:应该让Apache TomCat服务器在您的系统上本地运行您的Web项目(本地服务器)。安装步骤https://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html转到此网站。

Step 3:set Class path for java JRE.

第3步:设置java JRE的类路径。