Thursday, January 05, 2012

Access a properties file from JSP/JSTL EL

Sometimes you need to show information in a JSP from a properties file. Typical scenario is configuration data.

With spring you could do:

Then from a Listener or even from a Controller you could Autowire and inject the variable as a context or request attribute respectively:
public Properties applicationProperties;
request.setAttribute("applicationProperties", applicationProperties);

Suppose has this content:

Then from JSP/JSTL you can use it as:

No comments: