Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 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

sharing data

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
what are all the ways through which we can share the data between servlets and jsp in a single application.
is it possible to share data between servlets in two applications.if possible how
thankz
sri

is
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rather than ask for "All the ways" (very short question requiring a very long answer), why not explain, in some detail, what it is that you're trying to do.
Then, maybe someone will suggest the best strategy for your situation.

If you're not familiar with the various 'scope' objects made available by the servlet spec, I recommend that you download the spec and give it a read.
There is a link in my signature.

-Ben
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To share data in the same application its good use Java beans.

To share data in the different applications you can use the servletContext.
But few containers like Tomcat will restrict from you from doing this.
You can use DB to share the data, but which is constly interms of time.
I suggest you to use XML to share the data.
 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[Prasad]
To share data in the different applications you can use the servletContext.


Web applications do not share a ServletContext even if they are running in the same JVM.
 
author and cow tipper
Posts: 5006
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One way to share data is with a JavaBean and the HttpSession. That's pretty much basic JSP and Servlet development. I've got a set of free tutorials and sample code/war files that demonstrate how to use the HttpSession, and share a JavaBean between a Servlet and a JSP:

Link to Kameron's site



Cheers!

-Cameron McKenzie
[ November 03, 2006: Message edited by: Ben Souther ]
 
Those cherries would go best on cherry cheesecake. Don't put those cherries on this tiny ad:
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