将Java独立应用程序集成到Web

时间:2021-06-05 15:51:39

I develop Java applications with Eclipse that process data. So far I only developed stand alone applications that take data from file or database, process the data, and output the results to the console/file/database.

我使用Eclipse开发Java应用程序来处理数据。到目前为止,我只开发了独立应用程序,它从文件或数据库中获取数据,处理数据,并将结果输出到控制台/文件/数据库。

I would like put my application online. I never did any web development, but from my understanding, the only difference is that my code needs to be on a web server that can get http requests from users, and return http response based on my application's result.

我想把我的申请放在网上。我从来没有进行任何Web开发,但根据我的理解,唯一的区别是我的代码需要在可以从用户获取http请求的Web服务器上,并根据我的应用程序的结果返回http响应。

I would like to get advice on the easiest way I can do this. What technology do I need to learn and what tools I can use for making the transition easier. I would also like to separate my code from the code related to the web stuff.

我想以最简单的方式获得建议。我需要学习哪些技术以及可以使用哪些工具来简化过渡。我还想将我的代码与与Web内容相关的代码分开。

Thanks a lot!

非常感谢!

3 个解决方案

#1


2  

The simplest approach to developing Java web applications is via the Servlet specification. This lets you load your application into a Servlet container (such as Jetty or Tomcat), which handles the HTTP-side invocation issue. Your servlet is then a front-end for your front end agnostic processing application.

开发Java Web应用程序的最简单方法是通过Servlet规范。这使您可以将应用程序加载到Servlet容器(例如Jetty或Tomcat)中,该容器处理HTTP端调用问题。然后,您的servlet是前端不可知处理应用程序的前端。

Since all applications require a user interface, take a look at the myraid of possible templating languages available. Velocity is always a safe pick. This will help you seperate the user interface from the adapter code.

由于所有应用程序都需要用户界面,因此请查看可能的模板语言。速度始终是一个安全的选择。这将帮助您从适配器代码中分离用户界面。

#2


1  

While you investigate alternatives, Java Web Start may be the fastest way to get your existing application online. Here's a trivial example.

在研究替代方案时,Java Web Start可能是使现有应用程序联机的最快方法。这是一个简单的例子。

#3


0  

The easiest is most likely to learn how to write a simple servlet, how the HTML looks that you want to generate and then adapt your existing application to run inside the servlet code, and print html instead of just plain text.

最简单的是最有可能学习如何编写一个简单的servlet,如何生成HTML,然后调整现有的应用程序以在servlet代码中运行,并打印html而不是纯文本。

This is described in the Servlet part of the Java EE tutorial (which is not great, but a start)

这在Java EE教程的Servlet部分中描述(这不是很好,但是一个开始)

http://java.sun.com/javaee/5/docs/tutorial/doc/bnafe.html

If you want a more accessible book, I can recommend the Head First series. http://oreilly.com/catalog/9780596005405

如果你想要一本更容易理解的书,我可以推荐Head First系列。 http://oreilly.com/catalog/9780596005405

For a web container, Apache Tomcat is fine. http://tomcat.apache.org/

对于Web容器,Apache Tomcat很好。 http://tomcat.apache.org/

#1


2  

The simplest approach to developing Java web applications is via the Servlet specification. This lets you load your application into a Servlet container (such as Jetty or Tomcat), which handles the HTTP-side invocation issue. Your servlet is then a front-end for your front end agnostic processing application.

开发Java Web应用程序的最简单方法是通过Servlet规范。这使您可以将应用程序加载到Servlet容器(例如Jetty或Tomcat)中,该容器处理HTTP端调用问题。然后,您的servlet是前端不可知处理应用程序的前端。

Since all applications require a user interface, take a look at the myraid of possible templating languages available. Velocity is always a safe pick. This will help you seperate the user interface from the adapter code.

由于所有应用程序都需要用户界面,因此请查看可能的模板语言。速度始终是一个安全的选择。这将帮助您从适配器代码中分离用户界面。

#2


1  

While you investigate alternatives, Java Web Start may be the fastest way to get your existing application online. Here's a trivial example.

在研究替代方案时,Java Web Start可能是使现有应用程序联机的最快方法。这是一个简单的例子。

#3


0  

The easiest is most likely to learn how to write a simple servlet, how the HTML looks that you want to generate and then adapt your existing application to run inside the servlet code, and print html instead of just plain text.

最简单的是最有可能学习如何编写一个简单的servlet,如何生成HTML,然后调整现有的应用程序以在servlet代码中运行,并打印html而不是纯文本。

This is described in the Servlet part of the Java EE tutorial (which is not great, but a start)

这在Java EE教程的Servlet部分中描述(这不是很好,但是一个开始)

http://java.sun.com/javaee/5/docs/tutorial/doc/bnafe.html

If you want a more accessible book, I can recommend the Head First series. http://oreilly.com/catalog/9780596005405

如果你想要一本更容易理解的书,我可以推荐Head First系列。 http://oreilly.com/catalog/9780596005405

For a web container, Apache Tomcat is fine. http://tomcat.apache.org/

对于Web容器,Apache Tomcat很好。 http://tomcat.apache.org/