I was just wondering, that why do we need to import the default packages such as <%@ page import="java.util.*" %> to use ArrayList in our JSP. <% ArrayList f = new ArrayList(); f.add("A"); out.println(f); %>
Technically the above line of code, goes inside the service method & thats a regular java code. Any to any java code, java.util* is by default imported. Am i correct? If yes, then why do we need to import java.util in jsp to use collection related stuff...
which you would expect the engine to put in. Now, I'm using Sun Application Server 8.2 - maybe you're using something different which operates differently, but I'm 99% sure that it's not a requirement for a JSP to automatically import java.util.*
If your container is doing that import, well I've no idea - I just wouldn't count on it being a portable feature to other containers!
posted 13 years ago
I did the same for tomcat and as would expect just the same.