The output key for a localized message returning 0

I am trying to infer a key in a localized message in a jsp template as follows:

<c:set var="logo-tooltip-title"> <fmt:message key="logo.tooltip.title"/> </c:set> <c:out value="${logo-tooltip-title}"/> 

In my messages.properties file, the following:

 logo.tooltip.title=Test 

Does anyone know what I'm doing wrong here? Why does it return 0 instead of Test?

My goal is to display this message as the title of the following link:

  <a class="logo" href="/site/" title="${logo-tooltip-title}"> <img src="<hst:link path="/img/logo.png"/>" alt="logo" class="headlogo" width="80" height="100" /> </a> 

Any thoughts on the best approach to this?

Thanks!

EDIT:

yes I set the context parameter to web.xml:

  <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> <param-value>messages</param-value> </context-param> 

resource

Update:

It works:

 <fmt:message key="logo.tooltip.title" var="tooltip"/> <c:out value="${tooltip}"/> 
+4
source share
2 answers

I do not think your problem is specific to HippoCMS.

I tried your syntax and I think you are missing a package declaration. If I add the file org/ecausarano/Example.properties to military resources and:

 <fmt:setBundle basename="org.ecausarano.Example" /> <c:set var="message"> <fmt:message key="message.message" /> </c:set> <c:out value="${message}" /> 

he works for me.

+2
source

JSTL is trying to do the math for "logo - tooltip - title", which results in 0. You have already figured out that the replacement is. solved a problem.

+2
source

Source: https://habr.com/ru/post/1393356/


All Articles