views:

243

answers:

2

Hi,

I'm looking to implement a simple web-based application. The main reason I want to do it is to learn a bit about Java EE technologies, but I want to make sure that the approach I'm taking is sane.

The application should allow someone to upload a file (initially an image, but will be video eventually). I will do some analysis on the uploaded file, and then present the results back to the user, as well as storing the results in a database.

So, what I'm thinking of is:

  1. Write the (very simple) web-page using JSP,
  2. Have a servlet that reads the uploaded image and stores it on the server
  3. Have the servlet call an EJB that does the grunt work (analyses the image and saves the results in a database)
  4. After the EJB has done the analysis, it returns the results to the Servlet for presentation.

Does this sound reasonable, or am I way off??

Also, any particular technologies (spring?, a persistence lib?) people would recommend to implement it?

Thanks


Update

Found this great reference that seems to give a good step-by-step guide for what I want to do here. Thought it may be of use for people interested in this question.

+2  A: 

the apache commons FileUpload servlet can take care of the uploading for you. It simply returns a FileItem object which you can read and manipulate to your servlet. For something that simple, I would not recommend a framework, unless your already familiar with Spring or Struts. Most of the grunt work can be done by most popular IDEs (Eclipse in particular). I believe it would be better to do it that way, and then you can implement a framework later. That way you will appreciate what frameworks do without getting lost in the abstraction.

All in all, this sounds very reasonable, and should not be difficult to pull off. This will be a great way to learn J2EE. Good Learning!

bigjust
Thanks, had been using FileUpload alright, seems easy to use.
Lehane
+1 for FileUpload servlet
Yatendra Goel
+2  A: 

IMHO, unless you are locked in to EJBs, I would avoid that whole layer.

Using a framework like Spring or Structs, build the app using a MVC pattern, and have your controller talk to a decoupled service object to do the analysis. The service would return the result back to the controller, the controller could bundle that up into your model object to pass to the view for rendering.

jkf