Button clicking does not happen during the execution of a JSP. This seems to be an all too common misunderstanding. A JSP generates HTML which can contain variable data. Then the HTML is passed to the browser and the JSP execution is finished. That HTML may specify buttons, either as links or form submit buttons, which generate a new transaction, which in turn may result in the execution of another JSP.