//UsingBeanScopePage.java package Mybean; public class UsingBeanScopePage{ private static int counter = 0; public void setCounter(int counter) { this.counter = counter; } public int getCounter(){ return counter; } } //UsingBeanScopePage.jsp Using Beans and Page Scope

Using Beans and Page Scope

<% pageScopeBean.setCounter(pageScopeBean.getCounter() + 1); %> Counter value is <%= pageScopeBean.getCounter() %>