aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Question about Java Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Question about Java Beans" Watch "Question about Java Beans" New topic
Author

Question about Java Beans

Robert Strong
Ranch Hand

Joined: Sep 10, 2002
Posts: 84
I know Java Beans can be defined in a scope of page, request, session or application, and it exists as attributes of scope object.
I'm using MVC model, when servlets invoke EJBs to get the data, it puts data into the attributes of the scope Object(like session or request), and forward it to JSPs, the JSP then access the scope objects to display data.
I wonder, since Java Bean defined like <jsp:useBean id='..' class='...' scope='session'> still exists in session object, do I need to just use this tag to get the Java Bean instance in Session Object or instead access the session object to get the Java Bean?
any help appreciated!!!
John Carnell
Author
Ranch Hand

Joined: Sep 27, 2002
Posts: 71
Originally posted by Robert Strong:

I wonder, since Java Bean defined like <jsp:useBean id='..' class='...' scope='session'> still exists in session object, do I need to just use this tag to get the Java Bean instance in Session Object or instead access the session object to get the Java Bean?
any help appreciated!!!

If I understand your question Robert, as long as you have the item in the session, you should be able to use the <jsp:bean> tag to get access to it. You should not have to first get a reference to the session object then pull the Java Bean out. The <tag> should take care of that.
Thanks,
John Carnell


John Carnell<br />Principal Architect<br /> <br />Netchange, LLC<br />1161 HillCrest Heights<br />Green Bay, WI 54313<br /> <br />john.carnell@netchange.us<br /> <br /> <br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/159059228X/ref=jranch-20" target="_blank" rel="nofollow">Pro Jakarta Struts, Second Edition</a>
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15629
    
  15

When you provided the bean name, that was a key to a dictionary. The "scope=" parameter indicated WHICH dictionary, so by saying "scope=session", you've said that the bean should be located in the session object - which is a dictionary, courtesy of the set/getAttribute methods.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about Java Beans
 
Similar Threads
My SCEA Part 1Study Notes
How can I access JSF managed bean from JSF converter?
Session scope form bean problem
<jsp:include> and <jsp:useBean>
storing an object into session variable