This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Data sharing with Beans or Attributes?  RSS feed

 
Mark Howard
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a web application whose Servlets would retrieve database data and store them as attributes in Session scope. The JSP pages would then simply retrieve the appropriate session variables and use the data to render the browser pages.
The MVC design pattern advocates JavaBean objects as a way of sharing data between Servlets and JSP pages. My question is whether the one method (Attributes) is better than the other (Beans), whether its just a design/reusability issue, or whether there are any distinct advantages of the one over the other
Any input much appreciated.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The MVC pattern "says" nothing to preclude the use of attributes. However, I'd rethink plunking them onto the session in favor of the putting them onto the request and then forwarding the request to the JSP page.
hth,
bear
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!