views:

54

answers:

2

Hi,

Head First book says about include directive as include code from any other file into the JSP file at translation time, which can't be changed dynamically.

However, I included a JSP file in the include directive, which generates a number randomly every time I access the page with include directive. And every time a new number generates instead of only once during translation to servlet code. Why is that so?

Thanks in advance.

+1  A: 

The JSP file includes that other code, which in turn generates a random number when executed.

What it doesn't do is execute that other code and only include the output, which is what you expect if I understand you correctly.

ammoQ
+1  A: 

The 1st JSP file includes the code of 2nd JSP file at translation time. The random number you see is after execution.

If you now change your 2nd JSP then you won't see the changes when you access 1st JSP.

Bhushan