tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter lin <>
Subject Re: Sharing an object between servlets
Date Fri, 04 Oct 2002 14:52:17 GMT

Sounds like you want some kind of persistent storage that cross multiple
requests. If I am reading you correctly, rather than have one servlet do
both the html and png, you've split the functionality into two servlets.

Assuming you're using tomcat 4, you should be able to create a
light-weight application that uses a map. I can think of a couple
different ways to tackle the problem.

1. store the lat/long in the session. One down side of this is it may
bog down the session object if your object increases in size

2. create an application wide map that stores an object containing the
geocode (lat/long), using session as the key

3. store in a database using the session id as key

4. store it in some other persistent datastore

5. pass the lat/long in the URL the map generation servlet creates for
the html servlet

I'm not sure how you're generating the map url, since it sounds like the
map servlet handles that. I'm assuming the map servlet takes an address
or an equivalent to generate the graphic. You might want to provide more
specific information like the process flow to get better help.


Vijay Kandy wrote:
> Dear All,
> We are building a map tool - to draw maps and show some data on them. Now, I
> have this situation. I have a servlet that gets coordinates from the
> database and draws the map on its OutputStream (the content type is set to
> png image). There is another servlet (content type is text/html) that embeds
> the URL of the first servlet. This servlet also gets coordinates from the
> database, and populates them over the image so I can do some image map or
> mouseOver() tricks using javascript. I was wondering if there was a way to
> make just one call to the database and share the coordinates between the
> servlets. Right now, I will try any thing!
> Thank you,
> Vijay
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message