• Post Reply Bookmark Topic Watch Topic
  • New Topic

Design help with displaying images from DB  RSS feed

 
Sreyan Chakravarty
Ranch Hand
Posts: 65
Firefox Browser MyEclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making a mock social networking site for my college project. In the social networking site people have the option of uploading photos. So when a user clicks on the photos tab he/she can see all the pictures uploaded by him/her. What I want to know is that what is the best way of transferring this from the DB to the JSP.

I already have a bean object in the session that holds all the user details. But I don't think it will be a good idea to keep a list of all uploaded pictures in the session.

So what I am planning to do is make a list of all uploaded pics everytime the user wants to see his uploaded pics and then pass it to the JSP responsible for displaying images. But this method has the disadvantage of "hitting" the DB for every page request of the pictures page.

Is there a better way to do this. Any suggestions would be helpful.
 
Paul Clapham
Sheriff
Posts: 22379
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sreyan Chakravarty wrote:I already have a bean object in the session that holds all the user details. But I don't think it will be a good idea to keep a list of all uploaded pictures in the session.


No? Why don't you think it's a good idea?

So what I am planning to do is make a list of all uploaded pics everytime the user wants to see his uploaded pics and then pass it to the JSP responsible for displaying images. But this method has the disadvantage of "hitting" the DB for every page request of the pictures page.


And what's wrong with accessing the database? That's where the data is located, after all.

You seem to be making a lot of decisions about performance without having any information. I think it would be better if you at least explained why you made those decisions -- and keep in mind that you're writing a "toy" application where you aren't going to have a huge amount of data. I'd say that it doesn't really matter what you do, although perhaps you will have to explain why you chose a particular course of action? You didn't mention whether you had to defend your design or just produce a working site.
 
Sreyan Chakravarty
Ranch Hand
Posts: 65
Firefox Browser MyEclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:
Sreyan Chakravarty wrote:I already have a bean object in the session that holds all the user details. But I don't think it will be a good idea to keep a list of all uploaded pictures in the session.


No? Why don't you think it's a good idea?

So what I am planning to do is make a list of all uploaded pics everytime the user wants to see his uploaded pics and then pass it to the JSP responsible for displaying images. But this method has the disadvantage of "hitting" the DB for every page request of the pictures page.


And what's wrong with accessing the database? That's where the data is located, after all.

You seem to be making a lot of decisions about performance without having any information. I think it would be better if you at least explained why you made those decisions -- and keep in mind that you're writing a "toy" application where you aren't going to have a huge amount of data. I'd say that it doesn't really matter what you do, although perhaps you will have to explain why you chose a particular course of action? You didn't mention whether you had to defend your design or just produce a working site.


I just wanted to know if my methodology would be an industry best practice. I didn't find any information regarding how to properly handle uploaded content. That is, which method is preferred over the other.

I wanted to know how real social media web-apps handled these problems, then maybe I could follow their guidelines. Is there any room for improvement in my design or should I just go with it ?


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!