hst.bundle and fmt.message syntax

339 views
Skip to first unread message

moens...@gmail.com

unread,
Jan 20, 2017, 1:10:28 PM1/20/17
to Hippo Community
I'm trying to obtain several bundles from the CMS and use various values from each within a freemarker template.

i have three bundles named forms.fieldnames, forms.section-headings, and forms.buttons all with locale specific values.
There are 
forms.fieldnames -> first.name.fieldname
forms.section-headings->checkout.section-heading

I want to be able to access both values.

I'm tried doing the following:

<@hst.setBundle basename="forms.fieldnames" var="bundle1" />
<@fmt.message key="first.name.fieldname" bundle="bundle1"/>


[INFO] [talledLocalContainer] ----
[INFO] [talledLocalContainer] FTL stack trace ("~" means nesting-related):
[INFO] [talledLocalContainer]   - Failed at: @fmt.message key="checkout.section-he...  [in template "webfile:/freemarker/moen/account/product-registration.ftl" at line 116, column 104]
[INFO] [talledLocalContainer] ----. To see the stack trace, set 'org.hippoecm.hst.servlet.HstFreemarkerServlet' log-level to debug in log4j configuration or runtime via the logging servlet


What is the right syntax for getting the values from mutliple bundles?

thanks,

shee...@gmail.com

unread,
Jan 20, 2017, 1:30:35 PM1/20/17
to Hippo Community, moens...@gmail.com
I think you're problem is in your message tag. the bundle attribute should not be in quotes since it is an object. So you would have: 

<@hst.setBundle basename="forms.fieldnames" var="bundle1" />
<@fmt.message key="first.name.fieldname" bundle=bundle1/>

moens...@gmail.com

unread,
Jan 23, 2017, 10:51:41 AM1/23/17
to Hippo Community, moens...@gmail.com

When i don't use the quotes in the "fmt.message" line, i get ??key.name?? rather than the appropriate value.

Marijan Milicevic

unread,
Jan 23, 2017, 10:56:23 AM1/23/17
to hippo-c...@googlegroups.com, moens...@gmail.com
Hi,

On Mon, Jan 23, 2017 at 4:51 PM, <moens...@gmail.com> wrote:

When i don't use the quotes in the "fmt.message" line, i get ??key.name?? rather than the appropriate value.

sample from essentials [1]:
<#assign hst=JspTaglibs["http://www.hippoecm.org/jsp/hst/core"] >
<#assign fmt=JspTaglibs ["http://java.sun.com/jsp/jstl/fmt"] >
<@hst.defineObjects />
<@hst.setBundle basename="essentials.pagenotfound"/>
<h1><@fmt.message key="pagenotfound.title" var="title"/>${title?html}</h1>


cheers
marijan


 

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.


...
Reply all
Reply to author
Forward
0 new messages