I know to avoid JSP page from being cached we need to use code below. But if I have 1000 pages, instead of writing this code at each page, can i do it globally at one place? if so how to do it? Thanks.
I agree we should not put java code in the JSP but some time while working practically we will have lot of requirement which can be achieved easily using scriptlet.
For example doing some total of records or providing a href link from one column of each row displayed.
Java code belongs in Java classes.
To control requests and do some business logic, use a Servlet class.
To transfer data, use a Javabean class.
To interact with databases, use a DAO class.
To do some utility stuff, use an Utility class, if necessary wrapped by custom EL functions.