• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Translation tool in java  RSS feed

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
I'm using jsp,servlets,tomcat 4 to develop a webapplication. The application
can be accessed in many languages. I used to develop my applications
in asp , com before and there I could make an application object i global.asa load text from the database into the object and use it to gain
text from the object. If let's say the user clicked the US flag then english text could be retrieved from the object.
I used this so that I wouldn't have to access the database for every word
printed on the page. My question is. How do I do this in java.

I'm now using classes from Collection package and populates the collection
from the database. Now how can I store the my class in memory so that I can get data from my class not using new. i don't want to get the data from the database, just from the object!
// Mathias
 
Author
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the ServleteContext.
In your servlet do ServletConext sc = getServletContext();
then you cam store object references in the ServletContext like this
MyDataObject mdo = new MyDataObject();
sc.setAttribute("foo", mdo);
then to retrieve the data
MyDataObject mdo2 = (MyDataObject)sc.getAttribute("foo");
 
Mathias Nilsson
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
My english is a little weak. "ServletContext" what does that mean exactly?
// Mathias
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!