suppose i have a servlet that looks like the one below. i set a hashtable to be accessible by all the methods in the servlet. when user enters servlet, he goes into step1 and some values will be added to hashtable and then forward to jsp1. at jsp1, he clicks a button and it sends him back to the same servlet and goes into step2 and then send the hashtable to jsp2.
my question is, when the user goes into jsp2, are the values in hashtable added during step1 still the same or will the hashtable be reinitialised due to the new hashtable()?
my question is, when the user goes into jsp2, are the values in hashtable added during step1 still the same or will the hashtable be reinitialised due to the new hashtable()?
Code:
public class testServlet
{
[b]hashtable ht=new hashtable();[/b]
public void doPost()
{
if(step1)
{
.... add something to ht
request.setAttribute( hashtable ,ht);
forward to jsp1
}
else if(step2)
{
.... did not touch ht
request.setAttribute( hashtable ,ht);
forward to jsp2
}
}
}