简体   繁体   English

在Web服务器上简单地安装JDK是否足以运行Java Web应用程序?

[英]Does simply installing the JDK on a webserver suffice for running Java web app?

I have Java code that works on my desk top...its a simple app that grabs stuff from a database does something to it and outputs a list. 我的台式机上有Java代码...它有一个简单的应用程序,可以从数据库中获取内容,并对其进行输出。

This is for a consumer facing site and ultimately i want to pass the list on to PHP to use to furnish a page. 这是面向面向消费者的网站,最终我想将列表传递给PHP以用于提供页面。

I understand that I can do that with thrift and thats the current plan. 我知道我可以节俭地做到这一点,那就是当前的计划。

But the question is whether I need some special server besides just the JDK to run the java end of things given the fact that it is being used purely for data processing? 但是问题是,考虑到J纯粹是用于数据处理的事实,除了JDK之外我是否还需要一些特殊的服务器来运行Java事务? Why or why not? 为什么或者为什么不?

How does JRE/JDK handle different users trying to access user-specific data at the same time given that php has to grab that info from the same java application? 鉴于php必须从同一个Java应用程序中获取该信息,JRE / JDK如何处理试图同时访问用户特定数据的不同用户? how does the java program know the difference? Java程序如何知道差异?

Thanks alot for your help! 非常感谢你的帮助!

You need an J2EE server, which depending on the complexity of your application might be a JSP/Servlet engine like Apache Tomcat or a full-blown J2EE application server like GlassFish , jBoss or even a commercial product like Oracle Fusion middleware suite , which also includes features like user management, LDAP server, Sigle-Sign-on, Server farm Management tools etc. 您需要一个J2EE服务器,根据您应用程序的复杂性,它可能是一个JSP / Servlet引擎(例如Apache Tomcat),或者是功能完善的J2EE应用程序服务器(例如GlassFishjBoss) ,甚至是商业产品(例如Oracle Fusion中间件套件) ,其中还包括用户管理,LDAP服务器,Sigle登录,服务器场管理工具等功能。

On This server you typically run a J2EE/Web application, deployed as an WAR/EAR, see the Tutorial 在此服务器上,您通常会运行J2EE / Web应用程序,并以WAR / EAR的形式部署,请参阅教程。

EDIT : Description of a basic broser/HTTP/HTML webapp: The J2EE server provides an HTTP endpoint which can be invoked from a Browser via a HTTP request, eg http://localhost:80870/myApp/helloWorld?param=1 . 编辑 :基本的broser / HTTP / HTML webapp的描述:J2EE服务器提供一个HTTP端点,可以通过HTTP请求从浏览器调用该HTTP端点,例如http://localhost:80870/myApp/helloWorld?param=1 The HTTP request is dispatched to a particular Servlet (a Java class impmenting ther Servlet interface), depending on the server configuration and webapp deployment. 根据服务器配置和webapp部署,HTTP请求将分派到特定的Servlet(一个实现Servlet接口的Java类)。 The Servlet's doService method gets called by the J2EE server, then the servlet code can read any request parameters etc from the ServletRequest object passed into the method and can the construct a response (eg a HTML page) by writing it to the output stream of the ServletResponse object passed into the method. Servlet的doService方法由J2EE服务器调用,然后Servlet代码可以从传递给该方法的ServletRequest对象中读取任何请求参数等,并可以通过将响应写入到HTML的输出流中来构造响应(例如HTML页面)。 ServletResponse对象传递到方法中。 The response is then sent back to the user's browser. 然后将响应发送回用户的浏览器。

The J2EE container also provides a session functionality so that subsequent requests from the same browser session can share state. J2EE容器还提供了会话功能,以便来自同一浏览器会话的后续请求可以共享状态。

This is just the basic concept - for details on how this whole j2ee stuff works you should invest at least 8 hours in going through the very first Steps of the J2EE tutorial and get a HelloWorld JSP/Servlet running on your own server. 这只是基本概念-有关整个j2ee的工作原理的详细信息,您应该花费至少8个小时来完成J2EE教程的第一步,并在您自己的服务器上运行HelloWorld JSP / Servlet。 In case any detail questions arise during this, ask these questions at stackoverflow. 如果在此期间出现任何详细问题,请在stackoverflow上提出这些问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM