Re: booleans

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Monday, July 2, 2012, 7:04:18 AM, Attila Szegedi wrote:

> That's by design for booleans; use ${bug.resolved?string}. See
> <http://fmpp.sourceforge.net/freemarker/ref_builtins_boolean.html> for
> details.

For the sake of mail archives...

Something like ${bug.resolved?string('yes', 'no')} is more common.

Also of course, the latest docs are on freemarker.org, not on
fmpp.sf.net.

> On Mon, Jul 2, 2012 at 1:13 AM, S Ahmed <[email protected]> wrote:
>> (IntelliJ creates these properties for me using its code generation)
>>
>> I changed my view code from bug.isResolved to bug.resolved, still getting an
>> error....
>>
>> Bug.java:
>>
>>     public boolean isResolved() {
>>         return isResolved;
>>     }
>>
>>     public void setResolved(boolean resolved) {
>>         isResolved = resolved;
>>     }
>>
>> .ftl:
>>
>> ${bug.resolved}
>>
>>
>> I'm getting this error:
>>
>> org.springframework.web.util.NestedServletException: Request processing
>> failed; nested exception is freemarker.core.NonStringException: Error on
>> line 4, column 47 in bugs/show.ftl
>> Expecting a string, date or number here, Expression bug.resolved is instead
>> a freemarker.template.TemplateBooleanModel$1
>>       org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
>>       org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
>>       javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
>>       javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.