Results 1 to 4 of 4

Thread: Session or Request object in service layer

  1. #1
    Join Date
    Apr 2009
    Posts
    2

    Default 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.

  2. #2

    Default

    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

  3. #3
    Join Date
    Apr 2009
    Posts
    2

    Default 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.

  4. #4

    Default

    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
  •