This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

2 or more servlet sharing data

 
vinaya kumar thimmappa
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to design such a stuff using tomcat
 
kamlesh tayade
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use javaBean for the data sharing
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you just share more details about your requirement? What is the business objective?
 
Pradeep bhatt
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may store the data as in request or session scope as required.
 
vinaya kumar thimmappa
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am looking at various ways to share say some "input data" from user across servlets.

One way to do this is pass it using session variable or command line
is there any other way. I am not sure of using servlet context. Can we use this
 
Pradeep bhatt
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by vinaya kumar thimmappa:
i am looking at various ways to share say some "input data" from user across servlets.

One way to do this is pass it using session variable or command line
is there any other way. I am not sure of using servlet context. Can we use this



Can you tell us more about the data you want to share across servlets. Whether it can be used across multiple threads etc.
 
ankur rathi
Ranch Hand
Posts: 3850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by vinaya kumar thimmappa:
i am looking at various ways to share say some "input data" from user across servlets.

One way to do this is pass it using session variable or command line
is there any other way. I am not sure of using servlet context. Can we use this



Ofcourse context is sharable across all part of web application and so by all servlet.
But as everybody said, what is the requirement???
 
Vince HW Chan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the data is shared among all users in the same application,
then store it using servletcontext.

If the data is shared by only the user who created it,
the store it using session.

If the data is static and configured,
then create a single bean to store it and called it as a singleton.

If the data is not serializable or is too big in size,
put it in DB or file for sharing.

Anyone agree?
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!