#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    19
    Rep Power
    0

    counter to add everytime user clicks on a button


    how do i do a jsp program that counts how many times a user clicks on a button???

    or

    how do i do a jsp program that adds a number to a generated file every time he clicks on a generate button. eg when the user clicks the first time, the generated file will be named as abc1 but when the user clicks on it the second time, it will change to abc2...

    Pls reply asap...
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    First, you need to store your counter somewhere persistent. That means the session object, the request object, or a hidden form field.

    With the session:
    session.setAttribute("counter", session.getAttribute("counter")++);

IMN logo majestic logo threadwatch logo seochat tools logo