Odd missing values problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Odd missing values problem

Chris-10
I've tried adding each of these expressions to my template:

${item.publication!}
${item.publication!""}
${item.publication!"foo"}

For each, I get an error like this:
[ERROR: item.publication! evaluated to null string.]

item.publication returns a TemplateScalarModel, and the .getAsString()
method returns a null.

What am I doing wrong?

I did add the "missing values" example from the manual to the top of the
page and it works correctly:

${mouse!"No mouse."}
<#assign mouse="Jerry">
${mouse!"No mouse."}

No mouse.
Jerry


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|

Re: Odd missing values problem

Chris-10
Never mind. My "item" hash shouldn't be returning a TemplateScalarModel
at all, rather than returning one and having it generate a null string.

On 1/12/2011 1:23 PM, Chris wrote:

> I've tried adding each of these expressions to my template:
>
> ${item.publication!}
> ${item.publication!""}
> ${item.publication!"foo"}
>
> For each, I get an error like this:
> [ERROR: item.publication! evaluated to null string.]
>
> item.publication returns a TemplateScalarModel, and the .getAsString()
> method returns a null.
>
> What am I doing wrong?
>
> I did add the "missing values" example from the manual to the top of the
> page and it works correctly:
>
> ${mouse!"No mouse."}
> <#assign mouse="Jerry">
> ${mouse!"No mouse."}
>
> No mouse.
> Jerry
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl



------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user