Dave Tolls wrote:When you first go to that JSP page what will the value of "name" be?
That's the answer to your question.
A key thing, though, i that that Java code should not be in a JSP page.
Indeed the JSP page should not be accessible directly from the browser. You should be going via a servlet.
Rob Spoor wrote:Java looks at the declared type, not the actual type, when determining which methods can be called. The declared type is not your anonymous inner class' type, but Main. Since that has no init method, you can't call it.