Sundar,
For setting and getting session specific objects:
HttpSession session = servletrequest.getSession(true);//true tells the
servlet engine session mgr to create a session if one does not exist for
this request
Object myobject = session.getValue("my_session_object_name");
if (myobject == null)
session.putvalue("my_session_object_name",new MySessionObject());
For setting and getting servlet specific objects (AKA globals or member
variables):
Object myobject =
getServletConfig().getServletContext()).getAttribute("my_servlet_object_name");
if (myobject == null)
getServletConfig().getServletContext()).setAttribute("my_servlet_object_name",new
MyServletObject());
Hope this helps.
Gabriel Wong
http://www.ezwebtools.com
sundar wrote:
>
> hi,
>
> I'm designing an application using servlet environment.
> The idea is to create a mechanism that will store the current state of the
> business objects with the corresponding request object.If further
> request comes from the same session then the same object is to be passed to
> the request.
>
> It would be easier if the objects are retrieved from the
> global store.Is it difficult to maintain the business objects with
> the request and response object.
>
> Will the performance be affected if the objects are stored in hashtable.
> I assume that the request from the same session is handled in single thread.
> i want to know a single thread to process the multiple request is handled
> parellelyor serially.Is it posible to have this kind of setup with out efecting the
> performance.
>
> any advise regarding this type of design or similar designs
> will be helpful.
>
> thanx in advance.
>
> sundar
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html