How can I share objects across different sessions?
Answers were Sorted based on User's Feedback
Answer / sanjeev kumar
Information (It can be primitives or objects) can be shared
across different servlets in 3 ways in J2EE.
1) Request object-- If the data need to be shared with in
the request scope we can set it on request object with
request.setAttribute() method. And can be accessed from the
other servlet or JSP with request.getAttribute() method.
2) Session object-- If the data need to be shared with in
the session scope we can set it on session object with
session.setAttribute() method. And can be accessed from the
other servlet or JSP with session.getAttribute() method.
3) Context object-- If the data need to be shared with in
the context (Application) scope we can set it on context
object with context.setAttribute() method. And can be
accessed from the other servlet or JSP with
context.getAttribute() method.
| Is This Answer Correct ? | 16 Yes | 4 No |
with the help of session.setAttribute()and session.getAtribute()we can share Httpsession object across different servlet and jsp.
| Is This Answer Correct ? | 5 Yes | 0 No |
What is difference between Forward() and sendRedirect() methode?
What do you mean by web applications? Explain web application directory arrangement?
What is the servletconfig object?
Define servlet mapping?
What are the advantages of cookies?
hi actully i hav form columns with origin and destination names .as like as i need to create one more column with name amount. my requirement is when i select origin and destination columns automatically i need to get amount from database.how can i. please tel me with relative code
explain filters in java?
What is session variable in servlets?
How many servlet objects are created?
What is a Proxy Server?
Which method of the httpservletrequest object is used?
Explain url encoding?