when this jsp is accessed first time, it will run JspInit() thus incrementing x by 1.Then, <%= x++ %> would increment x by 1. By now x=2. Now if you access the same instance 2nd time, JspInit() wouldnot be called. just <%= x++ %> would increment x by 1. So the final value of x will be 3.

By now x=2. Now if you access the same instance 2nd time, JspInit() would not be called. just <%= x++ %> would increment x by 1. So the final value of x will be 3.[/QB]

Shouldn't it output 2 instead of 3?

<%= x++ %> ---> out.print(x++); // print x, then increment x But: <%= ++x %> ---> out.print(++x); // increment x, then print x

[Edit] Sorry. It should output 3. I forgot to take into account the

at the end of the jsp. [ April 13, 2007: Message edited by: Sergio Tridente ]