• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I pass reference of a global hashtable to a java bean?

 
Richard Vagner
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help with this:
I have A.jsp which has a application scope Hashtable as below
<jsp:useBean id="user" scope="application"class="java.utilHashtable"/>
use.put(session.getId(), loginName)
���

I have a java bean B.java which is supposed to remove the loginName when session expires.
C.jsp is supposed to retrieve the hashtable data from B.java and display in the browser for the currently logged on users.

My question I
1. how do I pass hashtable object from A.jsp to the bean B.java so that it can manipulate it? Or How do I establish a reference of the Hashtable(A.jsp) in B.java?
2. How do I retrieve the hashtable from B.java so that it can be displayed in C.jsp?

Thanks a lot,
Richard
 
chanoch wiggers
Author
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im not convinced that this question makes sense - why are you storing the session id and username in applicatino scope inside an application scope hashtable?
to answer one of your questions, any jsp can get a hold of a reference to the hashtable by getting the hashtable from applicatin scope. You can then pass that reference to any bean by passing it as a method parameter to the bean
Hashtable talbe = get hastable from application scope
bean.manipulateHashtable(hashtable);
the rest i didnt understand and wont without further explanatino of what you are trying to do.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!