简体   繁体   English

Java EE应用程序方法

[英]Java EE application approach

I have come up with a small project to help me learn Java EE, i'm unsure what technology best suites what I want to achieve however so i'm hoping someone can point me in the right direction. 我想出了一个小项目来帮助我学习Java EE,但是我不确定哪种技术最适合我想要实现的目标,因此我希望有人可以指出正确的方向。

What is essentially a gloried web crawler should be constantly running somewhere - maybe updating a database or not (the information will become out of date quickly so there might be no need to persist the information). 本质上是一个光荣的Web爬网程序应该一直在某个地方运行-也许不更新数据库(信息将很快过时,因此可能不需要保留信息)。

Clients can then view the up to date information when they log in, i presume a servlet is the best approach for this. 客户可以在登录时查看最新信息,我认为servlet是实现此目的的最佳方法。

I'm not sure what technology is best for this kind of 'always running service'. 我不确定哪种技术最适合这种“始终运行的服务”。 I want the information always there regardless of whether a client is viewing it or not. 我希望信息始终存在,无论客户端是否在查看它。

What approach would you take? 你会采取什么方法? While i realise it might not be the best solution using an application server for this, i'm doing this as a fun project for myself to help me learn. 虽然我意识到这可能不是使用应用程序服务器的最佳解决方案,但我正在将其作为一个有趣的项目供我自己使用,以帮助我学习。

have come up with a small project to help me learn Java EE, i'm unsure what technology best suites what I want to achieve however so i'm hoping someone can point me in the right direction.. 我想出了一个小项目来帮助我学习Java EE,但是我不确定哪种技术最适合我想要实现的目标,所以我希望有人可以向我指出正确的方向。

Let's try. 我们试试吧。 I'll base my answer on Java EE 6. 我的答案将基于Java EE 6。

Clients can then view the up to date information when they log in, I presume a servlet is the best approach for this. 客户可以在登录时查看最新信息,我认为servlet是实现此目的的最佳方法。

Or JSF 2.0 and Facelets (Facelets are the default view technology in JSF 2.0 and replace JSP as the view technology for pages) 或JSF 2.0和Facelets(Facelets是JSF 2.0中的默认视图技术,并将JSP替换为页面的视图技术)

I'm not sure what technology is best for this kind of 'always running service'. 我不确定哪种技术最适合这种“始终运行的服务”。 I want the information always there regardless of whether a client is viewing it or not. 我希望信息始终存在,无论客户端是否在查看它。

It would be probably easier to run this in another VM but you could try with an @Asynchronous bean with EJB 3.1. 在另一个VM中运行它可能会更容易,但是您可以尝试使用带有EJB 3.1的@Asynchronous bean。 See the links below. 请参阅下面的链接。

See also 也可以看看

Ill address each point below: 病态地址如下:

1) Your concern over storing data in a db or not. 1)您是否担心将数据存储在数据库中。 The information should be stored in a database as your server will die from not having enough memory to keep everything available freely. 信息应存储在数据库中,因为服务器将因没有足够的内存而无法自由使用所有内容而死掉。

2) When clients log in yes you would want to use a servlet. 2)当客户端登录是时,您将要使用servlet。 To be more specific you would want a layer of abstraction between the model and the database. 更具体地说,您需要模型和数据库之间的抽象层。 The Controller would speak with the model about its current state than proceed to paint the view (the web page) with the most recent data. 控制器将与模型谈论其当前状态,然后继续用最新数据绘制视图(网页)。

3) I wouldn't necessarily classify this as a service so to speak, but more so a portal of information. 3)可以这么说,我不一定将其归类为服务,而是将其归类为信息门户。 An application server is fine for this type of work as it provides a central point for clients to interface with the application. 应用服务器很适合这类工作,因为它为客户端提供了与应用交互的中心点。

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

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