If you are using IoC container such as Spring's application context you should never create managed bean instances by yourself. You always need to pull the instance out from the container - i.e. ApplicationContext
. Otherwise they will not be initalized with the necessary dependencies.
Now the question you should ask is - how can I get ApplicationContext
instance in a JSP tag class. The answer is simple - just look how the standard Spring tags are doing that (I mean that - go check that link).
// Example on how to obtain bean from JSP tag (ignoring context hierarchy)
WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext()).
getBeansOfType(Poll1DAO.class).values().iterator().next();