Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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: 8927
Firefox Browser Java Spring
  • 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: 8927
Firefox Browser Java Spring
  • 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: 3830
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic