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.
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).
Clients can then view the up to date information when they log in, i presume a servlet is the best approach for this.
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 doi开发者_如何学JAVAng 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..
Let's try. I'll base my answer on 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.
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)
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. See the links below.
See also
- Part Three: New Features in EJB 3.1
- News: Article: New features in EJB 3.1, Part III
- TOTD #139: Asynchronous Request Processing using Servlets 3.0 and Java EE 6
- TOTD #137: Asynchronous EJB, a light-weight JMS solution – Feature-rich Java EE 6
Ill address each point below:
1) Your concern over storing data in a db or not. 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. 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. An application server is fine for this type of work as it provides a central point for clients to interface with the application.
精彩评论