• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Technique for shared servlet data

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have gotten Servlets 4a to work by making the data to be shared static within its own class. Is this the proper technique for this type of problem?
Also, what is the correct way to call an html page up from within a servlet after the servlet work is completed (jump back to the html page without user intervention)?
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also used made the data in the mystery file static but marilyn came back and said that i am not supposed to use a global variable (which i take to mean a class variable) which i suppose meant that you should create an object of the class, but then it gets even trickier
To jump back to an HTML page just put a link in as you would in HTML in the servlet which the user can click onto, you just need to find the right location of the html page on the server.
[ August 08, 2002: Message edited by: Sam Tilley ]

9/8/02 OKAY got ya, my mistake, didnt ready your email properly, aah and now i know what she meant by a global variable
[ August 09, 2002: Message edited by: Sam Tilley ]
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems to me that in the web server environment, you can not guarantee that new instances of a servlet will not be created when needed. That being the case, how can you know that all servlets will be pointing to the same data unless the data is at the class level of your data class?
The other thing I am looking for is a way to redirect a servlet to a another web page WITHOUT user intervention.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by darryl failla:
It seems to me that in the web server environment, you can not guarantee that new instances of a servlet will not be created when needed. That being the case, how can you know that all servlets will be pointing to the same data unless the data is at the class level of your data class?



Static is ok. public static is not ok.

The other thing I am looking for is a way to redirect a servlet to a another web page WITHOUT user intervention.



Are you sure you want to redirect the servlet? You may want to search the servlets forum regarding this as it is not really related to the CattleDrive assignments. here is a start
 
This tiny ad is suggesting that maybe she should go play in traffic.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic