Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


deek

4 posts

Wannabe Geek
Inactive user


#16722 24-Oct-2007 20:04
Send private message

Hi geeks

Iam creating a site for booking movie tickets using J2EE,J2ME  and struts.

My question is fundamental. Iam following MVC or Model-View-Controller architecture , where each request from the client goes though  a controller Servlet and it's the controller which calls the business logic residing in Model(java classes). The controller in turn sends back the corresponding view (presentation) using jsp pages.

I have stored images ,corresponding to each movie, in a MySQL database.

Usually, when a client request comes for any specific information, i extract the data from database and store it in session in a way which can be extracted back in the JSP pages to be viewed by clients.

In this case, when a user request comes, for showing movie details, I extract images from MySQL database as usual.
But my doubt is
 a)  should i put the images (which are big) into session and open those images  on client side,from session, in JSP?
 b)  Or should i write the image extraction logic in the JSP page itself?

If I follow point (b) , i will be breaking the MVC architecture, since all business logic (including extraction from database)are supposd to be done in Model and not in the View.

If I follow point (a), my Session object size increases.

The only option will be to put the images statically on the JSP/HTML pages.

I hope iam clear to all u geeks out there.

Any suggestions will be very helpful.

Thanks
Deepak




Create new topic
frio
80 posts

Master Geek


  #95207 14-Nov-2007 19:23
Send private message

Heya Derek,
MVC is quite hard to follow in JSP pages - while Sun recommends it (and it is best programming practise), JSP pages and servlets can be quite hard to mold into an MVC framework.

I'd say the best option if you do strictly want to follow MVC methodologies would be a), but we all have to make sacrifices sadly... and in the interests of performance, I'd say the best overall option would be to violate MVC and just chuck the code in the view.

Good luck :).



deek

4 posts

Wannabe Geek
Inactive user


#95393 15-Nov-2007 19:08
Send private message




Thanks a lot  for your reply , Simon .Smile

Iam following point (a) only , by the way .










Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.