Results 1 to 8 of 8

Thread: server implementation on paging grid

  1. #1
    Ext User
    Join Date
    Jan 2009
    Posts
    5
    Vote Rating
    0
      0  

    Default server implementation on paging grid

    Hi,

    I'm looking at the Paging Grid example and have a question on the server implementation.

    In ExampleServiceImpl class

    Code:
    private List<Post> posts;
    
    public PagingLoadResult<Post> getPosts(final PagingLoadConfig config) {
        if (posts == null) {
          loadPosts();
        }
     
        // ignore the rest
    }
    I thought posts will always be null every time a new thread is instantiated. In my own implementation, class variables do get set to null ever time. But it seems to be working fine in the demo explorer. Any idea why?

  2. #2
    Sencha User
    Join Date
    Jul 2008
    Posts
    30
    Vote Rating
    0
      0  

    Talking

    look the code in examples, there are server side code paging implementation

  3. #3
    Ext User
    Join Date
    Jan 2009
    Posts
    5
    Vote Rating
    0
      0  

    Default

    Yes, I code I posted above is from the examples.

  4. #4
    Ext User
    Join Date
    Oct 2008
    Location
    Warsaw(PL)/Cottbus(GER)
    Posts
    215
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by haibin View Post
    Yes, I code I posted above is from the examples.
    I would like to help but i did not get ur question. Just not understanding it.

  5. #5
    Ext User
    Join Date
    Jan 2009
    Posts
    5
    Vote Rating
    0
      0  

    Default

    My understanding is if servlet is started in a new thread, then

    if (posts == null)

    will always be true. So loadPost() will be called every time when users click on Next Page on the paging tool. Obviously it should not be the case. What's wrong with my understanding?

  6. #6
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
      0  

    Default

    Quote Originally Posted by haibin View Post
    My understanding is if servlet is started in a new thread, then

    if (posts == null)

    will always be true. So loadPost() will be called every time when users click on Next Page on the paging tool. Obviously it should not be the case. What's wrong with my understanding?
    Servlets are session based - so this only happens per client instance, not per request.

  7. #7
    Ext User
    Join Date
    Jan 2009
    Posts
    5
    Vote Rating
    0
      0  

    Default

    I see. Thanks for your help.

    But where can I see those codes that handle sessions? I was looking for something like

    this.getThreadLocalRequest().getSession();

    in the ExampleServiceImpl.java

  8. #8
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
      0  

    Default

    ExampleServiceImpl extends RemoteServiceServlet, which extends HttpServlet

    This is a fundamental Servlet function where data is persistent.

    Read this -> http://www.novocode.com/doc/servlet-.../chapter1.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •