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 How do I pass reference of a global hashtable to a java bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How do I pass reference of a global hashtable to a java bean? " Watch "How do I pass reference of a global hashtable to a java bean? " New topic
Author

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

Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 103
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

Joined: May 24, 2001
Posts: 245
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.


chanoch<p><a href="http://www.amazon.com/exec/obidos/ASIN/1861007736/" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a>
 
 
subject: How do I pass reference of a global hashtable to a java bean?
 
Threads others viewed
How to keep values from calling multiple jsp
passing hidden field in jsp
current JSP page/file and included resources
Problem caused by pressing the 'BACK' button on the broswer
Need help: jsp: include relative path question!
IntelliJ Java IDE