Re: Error message
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Monday, September 5, 2011, 3:34:57 PM, Shervin Asgari wrote:
> Hi.
>
> I have two questions.
>
> I am using FreeMarker 3.2.17 together with JODReports.
>
> I have in OpenOffice.org created a template. In the content.xml file, I have the following:
>
> <text:p text:style-name="P2" />
> <text:p text:style-name="P5">Applicant:</text:p>
> <text:p text:style-name="P5" />
> <text:p
> text:style-name="P6">${motorferdsel.applicant.epost}</text:p>
> <text:p
> text:style-name="P6">${motorferdsel.applicant.id}</text:p>
> <text:p
> text:style-name="P6">${motorferdsel.applicant.name}</text:p>
> <text:p text:style-name="P6" />
>
> Now for some reason, freemarker doesnt like this:
> ${motorferdsel.applicant.epost}, but has no problem with the last two.
>
> It reports:
> Expression any is undefined on line 2, column 17 in content.xml.
> The problematic instruction:
> ----------
==>> ${motorferdsel.applicant.epost} escaped ${motorferdsel.applicant.epost?xml?replace("
> ","<text:line-break />")} [on line 4, column 6709 in content.xml]
> ----------
>
> 1. Why is that?
That's strange. The error message states that you refer to a variable
called "any" that is either null or it just doesn't exist. But the
quoted expression doesn't refer to "any", plus the quoted line is said
to be on line 4 (as opposed to line 2) and column 6079 (that's a long
line). It's like if the error is originated from another line than
what's stated. Maybe you have the #escape on line 2 column 17? Anyway
that still doesn't explain the "any" thing. What happens if you delete
everything from the file and only leave
${motorferdsel.applicant.epost} there?
> Second question:
>
> Expected hash. mfapproval evaluated instead to
> freemarker.template.SimpleScalar on line 4, column 7334 in content.xml.
> The problematic instruction:
> ----------
==>> ${mfapproval.created?datetime} escaped ${mfapproval.created?datetime?xml?replace("
> ","<text:line-break />")} [on line 4, column 7332 in content.xml]
> ----------
>
> Java backtrace for programmers:
> ----------
> freemarker.template.TemplateException: Expected hash. mfapproval
> evaluated instead to freemarker.template.SimpleScalar on line 4, column 7334 in content.xml.
>
> What does this error message mean?
That the value of mfapproval is a String, so you can't use it with the
"." operator. (Would be useful if it just says that...)
> BR
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev