• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about MVC model!

 
Robert Strong
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using MVC model, the servlet as a controller, calls the corresponding EJBs to get the data, and then forward it to JSPs. here I'm using Stateful Session Beans, which is attached to HttpSession Object. my question is: is it a good idea in JSPs, to reference Stateful Session Beans to display the data, or instead, have the data attached directly to HttpSession Object, thus get the data from the session object?
any help appreciated
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attach the data to the HttpSession OR (even better) take it OUT of the Session or EJB and put it into the HttpRequest before you invoke the JSP.
The reason is that it's darned near impossible to handle exceptions in a clean way in a JSP. You want to make sure that anything that can go wrong has already been handled before the JSP is ever invoked. Thus, making sure that everything is nice and neat and placed inside attributes of the HTTPRequest as Javabeans is a good way of assuring that.
Kykle
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sound advice.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!