Bear Bibeault wrote:As you are using the JSTL and EL why are you bothering with useBean and setProperty at all?
Bear Bibeault wrote:You need to use an HTTP uRL to address the image, not the file protocol.
Nam Ha Minh wrote:You have a delayed response because you wrote:
Thread.sleep(5000)
inside the servlet's processRequest() method.
Ulf Dittmer wrote:
Will i have only one instance of servlet for all requests or N-instances of servlet for N-requests?
You will have one instance, so the "a" field will be shared between all threads, whether they happen concurrently or not.
Winston Gutkowski wrote:
But, that said, you need to understand that there are two main phases that apply to these things, and they are almost completely independent.
1. static stuff is run/initialized when a class is loaded; and that happens when it is needed by the JVM, and it is usually only done ONCE.
2. Non-static stuff is run/initialized when each object is created, which may happen never, once, or a million times in a program.
Personally, I've never worried about it in 11 years of writing Java. If I create an object, or call a static method, I assume it's done; and I try to avoid situations where the order in which it's done makes any difference.
About the only thing that you really need to know is that constructors are run in hierarchical order (ie, Object first), which basically makes sense if you think about it.
HIH
Winston
Henry Wong wrote:
I believe the correct sequence, according to the JLS, is that static initialers should be executed in the order that the class is loaded. And that the order that it is loaded, is the order that it is needed. For example, if you access a static variable of the subclass, the subclass will be loaded only (the super class will not be loaded).
Henry
run:
A: static a1
B: static b1
B: second static block
main: C: c1 static
BUILD SUCCESSFUL (total time: 1 second)
Winston Gutkowski wrote:
Well, first up, I'm not sure how much education you're going to get from these contrived examples.
However,