user1573690
user1573690

Reputation: 361

Load early created object when servlet request coming

I am creating Map with data when the 1st request coming to servlet, then return it to JSP page, from that JSP page there is a another request coming to servlet and i want to have early created Map with data when 2nd request came, otherwise i have to load data again to new Map,

Is there any way to do this ? , i cant parse Map objects via HTTP request and i'am using Java

Thanks

Upvotes: 0

Views: 54

Answers (1)

AllTooSir
AllTooSir

Reputation: 49372

There are three ways I can think of :

  1. Put the data in the request scope and forward the requests using RequestDispatcher. This won't work if the requests are not forwarded and a new request is created.
  2. Put the data in the session scope , the data will be valid through out the session for a particular client.
  3. Put the data as ServletContext attribute , visible to all requests, sessions and throughout the web app.

Upvotes: 1

Related Questions