What's the difference between just binding objects to a session as session variables and creating a Bean and associating it to the session?

Ryan Breidenbach

There is no differce other than syntax. The <jsp:useBean> tag and its corresponding accessor tags were created more as another level of programming abstraction than anything else. If you look at the underlying servlet code that is generated from the JSP, <jsp:useBean ... scope="session" /> translates into retrieving the object from the session. And if the that object does not exist in the session, it is created (through the default contructor) and placed in the session.

The only difference between binding the object directly and creating a Bean is that the <jsp:useBean> tag must use classes that meet the minimum Bean requirements - Serializable and has a default contructor.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact