JSP - Clicking Links or Buttons Twice

Discussion in 'Java' started by Randhir Singh, Jan 14, 2004.

  1. Hello,

    I developed a straight forward J2EE web application that allows users
    to query a LDAP server. This app was built following a previous ASP
    version. The problem that I'm having is that anytime I click a link
    or button twice (before the link page loads up) the next page displays
    all the data twice. Additionally, if I have two queries running on
    the same machine in two different IE windows at the same time, the
    data from the second query shows up on the other query's page in
    addition to the data from the original query (hope that makes sense).
    It seems as if the iPlanet web server cant distinguish that the two IE
    windows are different sessions.

    My major question is:
    Why do JSP pages display data twice if a link or button is clicked
    twice, and how can i prevent this?

    Thanks,

    Randhir
     
    Randhir Singh, Jan 14, 2004
    #1
    1. Advertising

  2. Randhir Singh

    Ryan Stewart Guest

    "Randhir Singh" <> wrote in message
    news:...
    > Hello,
    >
    > I developed a straight forward J2EE web application that allows users
    > to query a LDAP server. This app was built following a previous ASP
    > version. The problem that I'm having is that anytime I click a link
    > or button twice (before the link page loads up) the next page displays
    > all the data twice. Additionally, if I have two queries running on
    > the same machine in two different IE windows at the same time, the
    > data from the second query shows up on the other query's page in
    > addition to the data from the original query (hope that makes sense).
    > It seems as if the iPlanet web server cant distinguish that the two IE
    > windows are different sessions.
    >
    > My major question is:
    > Why do JSP pages display data twice if a link or button is clicked
    > twice, and how can i prevent this?


    In my experience, they don't. Beyond that I'm afraid I can't offer much
    help. What are you doing with your JSPs? What are the links/buttons supposed
    to do?
     
    Ryan Stewart, Jan 15, 2004
    #2
    1. Advertising

  3. Randhir Singh

    Tony Morris Guest

    I'm going to take a punt and suggest you have a concurrent access issue.
    Your browser is issuing the request twice, and the server application (in
    this case, the J2EE app.) is not handling the requested data exclusively as
    it should.

    First place to look: do you have member variables as part of your
    servlet/JSP ? They must be protected from race conditions if you do.
    Second place to look: A profiler/debugger

    --
    Tony Morris
    (BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
    Software Engineer
    IBM Australia - Tivoli Security Software
    (2003 VTR1000F)


    "Randhir Singh" <> wrote in message
    news:...
    > Hello,
    >
    > I developed a straight forward J2EE web application that allows users
    > to query a LDAP server. This app was built following a previous ASP
    > version. The problem that I'm having is that anytime I click a link
    > or button twice (before the link page loads up) the next page displays
    > all the data twice. Additionally, if I have two queries running on
    > the same machine in two different IE windows at the same time, the
    > data from the second query shows up on the other query's page in
    > addition to the data from the original query (hope that makes sense).
    > It seems as if the iPlanet web server cant distinguish that the two IE
    > windows are different sessions.
    >
    > My major question is:
    > Why do JSP pages display data twice if a link or button is clicked
    > twice, and how can i prevent this?
    >
    > Thanks,
    >
    > Randhir
     
    Tony Morris, Jan 15, 2004
    #3
  4. These links are supposed to provide detail on a given entry.
    Basically, they will link users to another jsp page that displays
    formatted data (retrieved from the LDAP server). The data is
    displayed in a table. If the link is clicked twice the data will be
    displayed twice when it loads. However, if the user clicks refresh
    (on the page with the duplicate data) the page will be displayed
    correctly. Any help, insight, suggestions will be appreciated.
    Thanks for your quick response.

    Just a side note: If a user clicks refresh shortcut (<ctrl>+R) twice
    before a page has refreshed, the data will be displayed twice.


    "Ryan Stewart" <> wrote in message news:<>...
    > "Randhir Singh" <> wrote in message
    > news:...
    > > Hello,
    > >
    > > I developed a straight forward J2EE web application that allows users
    > > to query a LDAP server. This app was built following a previous ASP
    > > version. The problem that I'm having is that anytime I click a link
    > > or button twice (before the link page loads up) the next page displays
    > > all the data twice. Additionally, if I have two queries running on
    > > the same machine in two different IE windows at the same time, the
    > > data from the second query shows up on the other query's page in
    > > addition to the data from the original query (hope that makes sense).
    > > It seems as if the iPlanet web server cant distinguish that the two IE
    > > windows are different sessions.
    > >
    > > My major question is:
    > > Why do JSP pages display data twice if a link or button is clicked
    > > twice, and how can i prevent this?

    >
    > In my experience, they don't. Beyond that I'm afraid I can't offer much
    > help. What are you doing with your JSPs? What are the links/buttons supposed
    > to do?
     
    Randhir Singh, Jan 15, 2004
    #4
  5. Randhir Singh

    Debian User Guest

    Tony Morris <> wrote:
    > First place to look: do you have member variables as part of your
    > servlet/JSP ? They must be protected from race conditions if you do.


    This is AFAIK not a problem in JSP's, but it can be in servlets.
    To solve it, your servlets must be thread-safe. This means that the
    servlet and any singleton classes it uses may not use member variables to
    retain a state. You have the session for that.


    Oscar

    --
    No trees were harmed in creating this message.
    However, a large number of electrons were terribly inconvenienced.
     
    Debian User, Jan 16, 2004
    #5
  6. Debian User wrote:

    > Tony Morris <> wrote:
    >> First place to look: do you have member variables as part of your
    >> servlet/JSP ? They must be protected from race conditions if you do.

    >
    > This is AFAIK not a problem in JSP's, but it can be in servlets.


    That is incorrect. JSP's get translated to servlets, and are then used in
    the exact same way as servlets, so you need to be as cautious about thread
    safeness if you have member variables.

    --
    Kind regards,
    Christophe Vanfleteren
     
    Christophe Vanfleteren, Jan 17, 2004
    #6
  7. Randhir Singh

    Tony Morris Guest

    JSP == Servlet.

    All ya gotta to do is create a data member and not protect it from race
    conditions and you're in trouble,
    regardless of whether your source is a JSP or a servlet; at the end of the
    day, they are both servlets.

    --
    Tony Morris
    (BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
    Software Engineer
    IBM Australia - Tivoli Security Software
    (2003 VTR1000F)


    "Debian User" <> wrote in message
    news:40085fca$0$138$...
    > Tony Morris <> wrote:
    > > First place to look: do you have member variables as part of your
    > > servlet/JSP ? They must be protected from race conditions if you do.

    >
    > This is AFAIK not a problem in JSP's, but it can be in servlets.
    > To solve it, your servlets must be thread-safe. This means that the
    > servlet and any singleton classes it uses may not use member variables to
    > retain a state. You have the session for that.
    >
    >
    > Oscar
    >
    > --
    > No trees were harmed in creating this message.
    > However, a large number of electrons were terribly inconvenienced.
     
    Tony Morris, Jan 18, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    2
    Views:
    532
  2. Brent
    Replies:
    8
    Views:
    633
    John Wood
    Jun 28, 2004
  3. Jim Bayers

    How To Stop Students From Clicking Twice

    Jim Bayers, Sep 29, 2004, in forum: ASP .Net
    Replies:
    10
    Views:
    774
    Mike Newton
    Oct 1, 2004
  4. csgraham74

    Button requires clicking twice

    csgraham74, Dec 9, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    291
    csgraham74
    Dec 9, 2006
  5. =?Utf-8?B?QmFkaXM=?=

    Clicking twice to fire an event

    =?Utf-8?B?QmFkaXM=?=, Apr 3, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    318
    Ben Rush
    Apr 3, 2007
Loading...

Share This Page