The Counter class is in the foo package, but there’s nothing in the JSP to acknowledge that. It’s the same thing that happens to you with any other Java code, and you know the rule: import the package or use the fully-qualified class name in your code.
Counter.java
package foo;
public class Counter {
private static int count;
public static int getCount() {
count++;
return count;
}
}
JSP code was:
<% out.println(Counter.getCount()); %>
JSP code should be: