Reputation: 568
I have defined a context-param (in this case an URL) inside the J2EE Applicatons web.xml. I am trying to output this URL as Link inside a JSP using the jstl (1.1) Taglibrary. The Application is Java 1.4 based.
web.xml:
<web-app>
...
<context-param>
<param-name>my-url</param-name>
<param-value>http://foo.bar.net/index.html</param-value>
</context-param>
...
</web-app>
jsp:
<c:out value="${my-url}">
Where the url should be a zero "0" ist outputtet. I have also tried accessing the parameter with
<c:out value="${contextParam.my-url}">
and
<c:out value="${initParam.my-url}">
which leads to the same output.
Does anyone know how to correctly access a web.xml context-parameter from within a jsp?
Upvotes: 1
Views: 1676
Reputation: 403501
initParam
is the correct thing to use, but the minus sign may be confusing it, and making it interpret it as an arithmetic expression, resulting in a zero.
Try this instead:
<c:out value="${initParam['my-url']}">
Upvotes: 3