• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ew. You guys are ugly with a capital UG. Here, maybe this tiny ad can help:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic