I have a simple JSP page that has a form taking value of parameter val
<form action="test">
Insert Value<input type="text" name="val"/>
<input type="submit"/>
</form>
Next I have a servlet test.java which takes val and prints it. The servlets doGet method looks like this-
        String val=request.getParameter("val");
        response.setContentType("text/html");
        PrintWriter p=response.getWriter();
        p.println("Value of parameter is "+val);
Now, I've read that during initialization only one instance of servlet is created i.e. only one object of servlet is created and multiple requests are handled using Multiple Threads.
Now, since only one instance of servlet is created therefore only one instance of variable val must have been created which can hold just one value at a time, then why is it that during multiple requests each user can access its own value of val ?
Shouldn't the value of val be shared among multiple requests and reflect its change in corresponding requests ?
Please Help. Thanks.
 
     
     
    