-
Feb 15th, 2010, 05:38 AM
#1
Session or Request object in service layer
Hi,
I have to retrieve all the connected users from the servletContext object, but it is not accessible under serice layer.
How can I do this?
Help me out to resolve this issue.
-
Feb 15th, 2010, 05:56 AM
#2
Hi,
Its is not a good advise to use session or request object in your service layer.By doing that you are actually coupling your presentation layer with your service/business layer.
I believe you might be having a User domain object.If you want to keep the infor of all user in application scope then put in the servletContext and then when you want to send it to the Business layer then retrieve all the object from the ServletContext and put it in a map/list and then pass it to your Service Layer.
This is just one way of doing it.
Kartik
-
Feb 15th, 2010, 06:16 AM
#3
Session or Request object in service layer
Hi karthik,
Thanks for quick response. Actually I am directly calling the service layer methods by passing command line arguments instead from the UI. Here web layer itself is not used.
-
Feb 15th, 2010, 06:50 AM
#4
Hi,
You cant pass your context,request or session object as a command line argument.It needs a Web container to understand the the context,request or sessionAPI.
Even I dont know how to send a COllection Object as a command line args
Kartik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules