File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Data sharing with Beans or Attributes? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Data sharing with Beans or Attributes?" Watch "Data sharing with Beans or Attributes?" New topic
Author

Data sharing with Beans or Attributes?

Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
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 opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

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


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
 
subject: Data sharing with Beans or Attributes?
 
Threads others viewed
What Is the Proper Place To Create A Session Object?
Sun Certified Web Component Developer
Mock exams for JSP
New forum for Sun Certified Web Component Developer
IBM 287 ICE TEST
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture