My application is assumed to increment a property in a stateful EJB,
but it does not work. Sum=0 all the time. If I change it to Stateless it works.
As I understood a Stateful EJB is created one per a client, but in my case it is like one per a request.

Remote interface
import javax.ejb.Remote;

@Remote
public interface AddInterface {
int getSum();
}

Stateful EJB
import javax.ejb.Stateful;

@Stateful
public class SumBean implements AddInterface {
private int summa;

@Override
public int getSum() {
return summa++;
}
}

JSP client (summa.jsp)
<%
InitialContext ctx = new InitialContext();
AddInterface myBean = (AddInterface)
ctx.lookup(AddInterface.class.getName());
out.println(myBean.getSum());
%>
<form action="summa.jsp">
<input type="submit" value="Send" />
</form>