Information for users using screen reader software to work with eTouch SamePage. To repeat this information, press ALT+R key.

SamePage supports Internet Explorer 6 and Mozilla Firefox 2.0 and above. You need to enable Javascript, CSS and Images to work with SamePage.SamePage supports several global accesskeys to support keyboard navigation. For Internet Explorer the keys are:

For Firefox the keys are:

 Welcome guest
 Advanced Search
Help  
 
View   Discussion   Edit   Attachments  
Discussion Forums View Page as PDF  View Page as Word  Printable View 
 

Previous | Next



eTouch SamePage inherently facilitates Discussion Forums by allowing users to comment on any information in the wiki page. Users can either click on the Discussion Tab or simply email their comments. These comments get archived to create vibrant discussion forums.








Storing images in server
jim on 02/15/2006 12:35 + Reply

 Hello Friends,
 I am working on a j2ee project , swing as front end. I need to sore and retrive the images of persons . I don't know how to upload and download the photos.
Where should i store the image. Is it in the war file or some other location in the server. Plz help to find a way to this solution.
Thanks in advance.
Jim
RE: Storing images in server
sarah on 02/15/2006 12:39 + Reply

The question you need to ask yourself is:

Will the images be changed/added to?

If these are just static images that will not _ever_ change once the application is deployed, then you could store them in the swing front end, or maybe have some class serialize them on the server and send them to your front end...

I think you are wanting the images to be updateable, and added to, etc... that sounds like the job for a database, and you'll have a server side class push/pull the images in/out of the database (where they will be stored as BLOBs)

Sarah
RE: Storing images in server
jim on 02/16/2006 11:35 + Reply

Thanks 4 the reply. These inages are static.. photos of employees . I am using mySql . I heard abt using the BLOB but i don't find suitable documents/ code . Can u tell abt it.
Jim
RE: Storing images in server
sarah on 02/16/2006 12:01 + Reply

> Thanks 4 the reply. These inages are static.. photos of employees .

So the employees never change... nobody grows a beard or loses hair?

And what about new employees? Does nobody retire?

Do you want to have to re-package the application in the event of those kinds of changes...

Fair enough, each image file may not be replaced, but the number of image files you will need can only grow.

You need a database table to hold the images... One column for image ID and the other will be a BLOB column... get your DBA to help you design it.
Then have a simple class that accesses the colum... If you are using EJB2, then an Entity will be the type of class and you'll need some sort of facade to transform the EJB entity into a POJO DTO... If you're using Hibernate or EJB3 or some such, then you'll use a POJO directly to be both the interface to the database table and the other side.
RE: Storing images in server
chris on 02/16/2006 12:35 + Reply

Here's a thought...

if your employer is stupid enough to fall for it!!! 

Store the images in the swing front end jar directly.

End of problem 

RE: Storing images in server
jim on 02/17/2006 9:35 + Reply

Sorry i intended dynamic unfortunately i typed static. U r right Sarah, it has to be dynamic. I am using EJB2, struts framework . But am sad to say that i don't get u. 
 Can I store the images in folder in the war file. Then can add new photos to it ?. How can i retrieve it to the client ? How can i store it .. These are the questions .

Thanks
Jim
RE: Storing images in server
sarah on 02/15/2006 10:15 + Reply

There are several ways to manage images. Minimally, they're typically simply managed as a byte array (byte[]) within Java. You can then convert that to images or whatever when you need it.

If you know that your server explodes your WAR on the server during deployment, you can simply store them in a directory beneath the root. You can use ServletContext.getRealPath("/") to find the base file system directory and go from there.

However, not all servers deploy by exploding the WAR file. Some run straight from the WAR, or have it as an option. Also, if you're working (or intend to work) in a clustered environment,then you can have issues as well. They're things to note, but in fact may not affect you at all.

The next option is to store the images in the DB. Most DBs support a BLOB or LONG RAW or BYTE datatype that's designed for this. Some of them have restrictions on how many of these columns can be in a table, and different DB's may handle BLOBs differently from others. But, nonetheless, all of the modern DBs have SOME way of handling this.

There is a MySQL example at the bottom of this page that I found after some quick searching that may help you. http://dev.mysql.com/doc/refman/5.0/en/blob.html