Hi,
How I can access attributes from Velocity template stored in Servlet Context
I have listerer
public class StartListener implements ServletContextListener { private static final Logger log = LoggerFactory.getLogger(StartListener.class); @Override public void contextInitialized(ServletContextEvent sce) { log.info("App starts"); ServletContext servletContext = sce.getServletContext(); servletContext.setAttribute("links", new Links()); } @Override public void contextDestroyed(ServletContextEvent sce) { log.info("App ends"); } }
In servlet I can do
Links links = (Links) getServletContext().getAttribute("links");
But I want to accses "links" directly from velocity template.
Hi,
Did you try to do
${links}
in your Velocity template?
Fred
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.